Udostępnij za pośrednictwem


ActionClickEventHandler Delegate (2007 System)

Represents the method that will handle the Click event of an Action.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
Public Delegate Sub ActionClickEventHandler ( _
    sender As Object, _
    e As ActionEventArgs _
)
'Usage
Dim instance As New ActionClickEventHandler(AddressOf HandlerMethod)
public delegate void ActionClickEventHandler(
    Object sender,
    ActionEventArgs e
)
public delegate void ActionClickEventHandler(
    Object^ sender, 
    ActionEventArgs^ e
)
JScript does not support delegates.

Parameters

Remarks

When you create an ActionClickEventHandler 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, unless you remove the delegate. For more information about delegates, see Events and Delegates.

Examples

The following code example demonstrates a handler for the Click event. The event handler displays the start and end position of the recognized smart tag term. This code example is part of a larger example provided for the Action class.

This example is for a document-level customization.

Private Sub DisplayAddress_Click(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ActionEventArgs) _
    Handles displayAddress.Click

    Dim termStart As Integer = e.Range.Start
    Dim termEnd As Integer = e.Range.End
    MsgBox("The recognized text '" & e.Text & _
            "' begins at position " & termStart & _
            " and ends at position " & termEnd)
End Sub
void displayAddress_Click(object sender,
    Microsoft.Office.Tools.Word.ActionEventArgs e)
{
    int termStart = e.Range.Start;
    int termEnd = e.Range.End;
    System.Windows.Forms.MessageBox.Show("The recognized text '" + e.Text +
        "' begins at position " + termStart.ToString() +
        " and ends at position " + termEnd.ToString());
}

See Also

Reference

Microsoft.Office.Tools.Word Namespace