Condividi tramite


Evento DocumentBase.SelectionChange

Viene generato quando cambia la selezione nella finestra del documento.

Spazio dei nomi:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Sintassi

'Dichiarazione
Public Event SelectionChange As SelectionEventHandler
public event SelectionEventHandler SelectionChange

Esempi

Nell'esempio di codice riportato di seguito viene illustrato come visualizzare un messaggio che indica che la selezione è cambiata ogni volta che si cambia la selezione all'interno del documento. Per utilizzare questo esempio, eseguirlo dalla classe ThisDocument in un progetto a livello di documento.

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.");
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

DocumentBase Classe

Spazio dei nomi Microsoft.Office.Tools.Word