Document.BeforeDoubleClick Event

Definition

Occurs when the editing area of the document window is double-clicked, before the default double-click action.

public:
 event Microsoft::Office::Tools::Word::ClickEventHandler ^ BeforeDoubleClick;
event Microsoft.Office.Tools.Word.ClickEventHandler BeforeDoubleClick;
member this.BeforeDoubleClick : Microsoft.Office.Tools.Word.ClickEventHandler 
Event BeforeDoubleClick As ClickEventHandler 

Event Type

Examples

The following code example displays a message when you double-click the document. This example is for an application-level add-in.

private void DocumentBeforeDoubleClick()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.BeforeDoubleClick += new Microsoft.Office.Tools.Word.ClickEventHandler(ThisDocument_BeforeDoubleClick);            
}

void ThisDocument_BeforeDoubleClick(object sender, Microsoft.Office.Tools.Word.ClickEventArgs e)
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    System.Windows.Forms.MessageBox.Show(vstoDoc.Name + " was double-clicked.");
}
Private Sub DocumentBeforeDoubleClick()
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    AddHandler vstoDoc.BeforeDoubleClick, AddressOf ThisDocument_BeforeDoubleClick
End Sub

Private Sub ThisDocument_BeforeDoubleClick(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Word.ClickEventArgs)
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    System.Windows.Forms.MessageBox.Show(vstoDoc.Name & " was double-clicked.")
End Sub

Remarks

To prevent the default double-click action from occurring, set the Cancel argument of the provided CancelEventArgs object to true.

Applies to