Bookmark.SelectionChange Olay

Tanım

Denetimin içindeki seçim Bookmark değiştiğinde gerçekleşir.

event Microsoft.Office.Tools.Word.SelectionEventHandler SelectionChange;

Olay Türü

SelectionEventHandler

Örnekler

Aşağıdaki kod örneği, Bookmark belgeye metin içeren bir denetim ekler ve sonra bir SelectionChange olay işleyicisi oluşturur. İmleç yer işareti içinde taşındığında bir ileti kutusu görüntülenir.

Bu örnek, belge düzeyinde özelleştirme içindir

Microsoft.Office.Tools.Word.Bookmark bookmark5;

private void BookmarkSelectionChange()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    bookmark5 = this.Controls.AddBookmark(this.Paragraphs[1]
        .Range, "bookmark5");
    bookmark5.Text = "This is a sample bookmark.";
    bookmark5.SelectionChange += new Microsoft.Office.Tools.Word.SelectionEventHandler(bookmark5_SelectionChange);
}

void bookmark5_SelectionChange(object sender, Microsoft.Office.Tools.Word.SelectionEventArgs e)
{
    MessageBox.Show("The selection has changed within bookmark1.");
}
WithEvents Bookmark5 As Microsoft.Office.Tools.Word.Bookmark

Private Sub BookmarkSelectionChange()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Bookmark5 = Me.Controls.AddBookmark(Me.Paragraphs(1).Range, _
        "Bookmark5")
    Bookmark5.Text = "This is a sample bookmark."
End Sub

Private Sub Bookmark5_SelectionChange(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.SelectionEventArgs) _
    Handles Bookmark5.SelectionChange
    MessageBox.Show("The selection has changed within Bookmark1.")
End Sub

Açıklamalar

Bu olay, seçim denetimin içinde veya içinde değiştirildiğinde tetiklenir Bookmark .

Şunlara uygulanır