Udostępnij za pośrednictwem


ClickEventHandler Delegate

Definition

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

public delegate void ClickEventHandler(System::Object ^ sender, ClickEventArgs ^ e);
public delegate void ClickEventHandler(object sender, ClickEventArgs e);
type ClickEventHandler = delegate of obj * ClickEventArgs -> unit
Public Delegate Sub ClickEventHandler(sender As Object, e As ClickEventArgs)

Parameters

sender
Object

The source of the event.

e
ClickEventArgs

A ClickEventArgs that contains the event data.

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 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.");
}
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

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.

Applies to