Bookmark.Deselected 事件
当选择从 Bookmark 控件移到 Bookmark 控件之外的某个区域时发生。
命名空间: Microsoft.Office.Tools.Word
程序集: Microsoft.Office.Tools.Word(在 Microsoft.Office.Tools.Word.dll 中)
语法
声明
Event Deselected As SelectionEventHandler
event SelectionEventHandler Deselected
备注
仅当 Bookmark 控件具有焦点,然后将焦点移出 Bookmark 控件时,才引发此事件。
示例
下面的代码示例向文档的第一个段落添加一个带有文本的 Bookmark 控件,并创建一个 Deselected 事件处理程序。当用户将光标从书签内移到书签外的某个区域时,会显示一个消息框。
此示例针对的是文档级自定义项。
WithEvents BookmarkDeselect As Microsoft.Office.Tools.Word.Bookmark
Private Sub BookmarkDeselected()
Me.Paragraphs(1).Range.InsertParagraphBefore()
BookmarkDeselect = Me.Controls.AddBookmark( _
Me.Paragraphs(1).Range, "BookmarkDeselect")
BookmarkDeselect.Text = "This is a sample bookmark."
End Sub
Private Sub BookmarkDeselect_Deselected(ByVal sender As Object, _
ByVal e As Microsoft.Office.Tools.Word.SelectionEventArgs) _
Handles BookmarkDeselect.Deselected
MessageBox.Show("The selection has moved outside of the bookmark")
End Sub
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");
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。