Compartir a través de


ClickEventHandler Delegate

Represents the method that will handle the BeforeDoubleClick and BeforeRightClick events of a Document.

Namespace:  Microsoft.Office.Tools.Word
Assemblies:   Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)
  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

Syntax

'Declaration
Public Delegate Sub ClickEventHandler ( _
    sender As Object, _
    e As ClickEventArgs _
)
public delegate void ClickEventHandler(
    Object sender,
    ClickEventArgs e
)

Parameters

Remarks

When you create a ClickEventHandler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, until you remove the delegate.

Examples

The following code example demonstrates an event handler for the BeforeDoubleClick event. The event handler displays a message when the user double-clicks the document.

This example is for a document-level customization.

Private Sub DocumentBeforeDoubleClick()
    AddHandler Me.BeforeDoubleClick, AddressOf ThisDocument_BeforeDoubleClick
End Sub 

Private Sub ThisDocument_BeforeDoubleClick(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Word.ClickEventArgs)
    MessageBox.Show(Me.Name & " was double-clicked.")
End Sub
private void DocumentBeforeDoubleClick()
{
    this.BeforeDoubleClick += new Microsoft.Office.Tools.Word.ClickEventHandler(ThisDocument_BeforeDoubleClick);
}

void ThisDocument_BeforeDoubleClick(object sender, Microsoft.Office.Tools.Word.ClickEventArgs e)
{
    MessageBox.Show(this.Name + " was double-clicked.");
}

See Also

Reference

Microsoft.Office.Tools.Word Namespace