DocumentBase.SelectionChange, événement

Se produit lorsque la sélection change dans la fenêtre de document.

Espace de noms :  Microsoft.Office.Tools.Word
Assembly :  Microsoft.Office.Tools.Word.v4.0.Utilities (dans Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntaxe

'Déclaration
Public Event SelectionChange As SelectionEventHandler
public event SelectionEventHandler SelectionChange

Exemples

L'exemple de code suivant affiche un message qui indique que la sélection a changé chaque fois que vous modifiez la sélection dans le document. Pour utiliser cet exemple, exécutez-le à partir de la classe ThisDocument dans un projet au niveau du document.

Private Sub DocumentSelectionChange()
    AddHandler Me.SelectionChange, AddressOf ThisDocument_SelectionChange
End Sub

Private Sub ThisDocument_SelectionChange(ByVal sender As Object, ByVal e As Microsoft.Office. _
    Tools.Word.SelectionEventArgs)
    MessageBox.Show("The selection in the document has changed.")
End Sub
private void DocumentSelectionChange()
{
    this.SelectionChange += new Microsoft.Office.Tools.Word.SelectionEventHandler(ThisDocument_SelectionChange);
}

void ThisDocument_SelectionChange(object sender, Microsoft.Office.Tools.Word.SelectionEventArgs e)
{
    MessageBox.Show("The selection in the document has changed.");
}

Sécurité .NET Framework

Voir aussi

Référence

DocumentBase Classe

Microsoft.Office.Tools.Word, espace de noms