DocumentBase.SelectionChange 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在文档窗口中的选定内容发生更改时发生。
public event Microsoft.Office.Tools.Word.SelectionEventHandler SelectionChange;
事件类型
示例
下面的代码示例显示一条消息,指示每当你更改文档中的选定内容时,所选内容已更改。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。
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.");
}
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