This topic has not yet been rated - Rate this topic

Bookmark.Deselected Event

Occurs when selection moves from the Bookmark control to an area outside of the Bookmark control.

Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in microsoft.office.tools.word.dll)

public event SelectionEventHandler Deselected

This event is raised only when the Bookmark control has focus, and then focus is transferred away from the Bookmark control.

The following code example adds a Bookmark control with text to the first paragraph of the document and creates a Deselected event handler. A message box is displayed when the user moves the cursor from inside the bookmark to an area outside of the bookmark.

Microsoft.Office.Tools.Word.Bookmark bookmarkDeselect;

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

void  bookmarkDeselect_Deselected(object sender, Microsoft.Office.Tools.Word.SelectionEventArgs e)
{
    MessageBox.Show("The selection has moved outside of the bookmark");
}

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.