Sdílet prostřednictvím


TextSelection.Delete-Methode

Aktualisiert: November 2007

Löscht den markierten Text.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
Sub Delete ( _
    Count As Integer _
)
'Usage
Dim instance As TextSelection
Dim Count As Integer

instance.Delete(Count)
void Delete(
    int Count
)
void Delete(
    [InAttribute] int Count
)
function Delete(
    Count : int
)

Parameter

  • Count
    Typ: System.Int32

    Optional. Stellt die Anzahl der zu löschenden Zeichen dar.

Hinweise

Delete löscht den markierten Text, ohne diesen zuvor in die Zwischenablage zu kopieren. Wenn kein Text markiert ist, löscht DeleteCount Zeichen rechts neben dem aktiven Endpunkt. Wenn Count negativ ist, verhält sich Delete wie DeleteLeft.

Beispiele

Public objSel As TextSelection = DTE.ActiveDocument.Selection

Sub DeleteExample()
   ' Before running this example, open a text document.
   ' Perform operations on the text.
   objSel.StartOfDocument(False)
   Position(vsStartOfLineOptions.vsStartOfLineOptionsFirstColumn, 4)
   objSel.Copy()
   Position(vsStartOfLineOptions.vsStartOfLineOptionsFirstText, 4)
   objSel.Cut()
   Position(vsStartOfLineOptions.vsStartOfLineOptionsFirstText, 4)
   objSel.Delete()
   Position(vsStartOfLineOptions.vsStartOfLineOptionsFirstText, 4)
   objSel.DeleteLeft(6)
   objSel.DestructiveInsert("NEW TEXT")
End Sub

Sub Position(ByVal pos As vsStartOfLineOptions, ByVal ipos As Integer)
   ' Moves the insertion point down to the beginning of the next line, 
   ' then highlights the right-most four characters.
   objSel.LineDown()
   objSel.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
   objSel.CharRight(True, 4)
End Sub

Berechtigungen

Siehe auch

Referenz

TextSelection-Schnittstelle

TextSelection-Member

EnvDTE-Namespace