TextSelection.Delete, méthode

Supprime la sélection de texte.

Espace de noms :  EnvDTE
Assembly :  EnvDTE (dans EnvDTE.dll)

Syntaxe

'Déclaration
Sub Delete ( _
    Count As Integer _
)
void Delete(
    int Count
)
void Delete(
    [InAttribute] int Count
)
abstract Delete : 
        Count:int -> unit
function Delete(
    Count : int
)

Paramètres

  • Count
    Type : Int32

    Optionnel. Représente le nombre de caractères à supprimer.

Notes

Delete supprime la sélection de texte sans la première copie en Presse-papiers. Si aucun texte n'est sélectionné, Deletesupprime Count caractères à la droite de l'extrémité active. Si la valeur de Count est négative, Delete agit comme DeleteLeft.

Exemples

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

Sécurité .NET Framework

Voir aussi

Référence

TextSelection Interface

EnvDTE, espace de noms