Partager via


Bookmark.BeforeRightClick, événement (System 2007)

Mise à jour : novembre 2007

Se produit lors d'un clic avec le bouton droit sur un contrôle Bookmark, avant l'action par défaut du clic avec le bouton droit.

Espace de noms :  Microsoft.Office.Tools.Word
Assembly :  Microsoft.Office.Tools.Word.v9.0 (dans Microsoft.Office.Tools.Word.v9.0.dll)

Syntaxe

Public Event BeforeRightClick As ClickEventHandler

Dim instance As Bookmark
Dim handler As ClickEventHandler

AddHandler instance.BeforeRightClick, handler
public event ClickEventHandler BeforeRightClick

Notes

Un clic avec le bouton droit sur des contrôles Bookmark qui se chevauchent déclenche l'événement sur chacun des signets concernés.

Exemples

L'exemple de code suivant ajoute un contrôle Bookmark au document, puis crée un gestionnaire d'événements BeforeRightClick. Lors d'un clic avec le bouton droit sur le contrôle Bookmark, le texte du signet est copié vers le Presse-papiers.

Cet exemple illustre une personnalisation au niveau du document.

WithEvents Bookmark3 As Microsoft.Office.Tools.Word.Bookmark

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

Private Sub Bookmark3_BeforeRightClick(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ClickEventArgs) _
    Handles Bookmark3.BeforeRightClick
    Bookmark3.Copy()
    e.Cancel = True
End Sub
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;
}

Autorisations

Voir aussi

Référence

Bookmark, classe

Membres Bookmark

Microsoft.Office.Tools.Word, espace de noms