Bookmark.BeforeRightClick Event
Visual Studio 2005
Occurs when a Bookmark control is right-clicked, before the default right-click action.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in microsoft.office.tools.word.dll)
Assembly: Microsoft.Office.Tools.Word (in microsoft.office.tools.word.dll)
The following code example adds a Bookmark control to the document and then creates a BeforeRightClick event handler. When the Bookmark control is right-clicked, the text within the bookmark is copied to the Clipboard.
Microsoft.Office.Tools.Word.Bookmark bookmark3; private void BookmarkBeforeRightClick() { this.Paragraphs[1].Range.InsertParagraphBefore(); bookmark3 = this.Controls.AddBookmark(this.Paragraphs[1] .Range, "bookmark3"); bookmark3.Text = "This is a sample bookmark."; bookmark3.BeforeRightClick += new Microsoft.Office.Tools .Word.ClickEventHandler(bookmark3_BeforeRightClick); } void bookmark3_BeforeRightClick(object sender, Microsoft.Office.Tools.Word.ClickEventArgs e) { bookmark3.Copy(); e.Cancel = true; }