다음을 통해 공유


Action.BeforeCaptionShow Event

Definition

Occurs after the user clicks the smart tags icon, and before the smart tag menu is displayed. This type or member is intended to be used only in projects for the 2007 Microsoft Office system. Smart tags are deprecated in Office 2010..

public:
 event Microsoft::Office::Tools::Word::BeforeCaptionShowEventHandler ^ BeforeCaptionShow;
event Microsoft.Office.Tools.Word.BeforeCaptionShowEventHandler BeforeCaptionShow;
member this.BeforeCaptionShow : Microsoft.Office.Tools.Word.BeforeCaptionShowEventHandler 
Event BeforeCaptionShow As BeforeCaptionShowEventHandler 

Event Type

Examples

The following code example demonstrates a handler for the BeforeCaptionShow event. The event handler modifies the menu caption of the action. This code example is part of a larger example provided for Action.

void displayAddress_BeforeCaptionShow(object sender,
    Microsoft.Office.Tools.Word.ActionEventArgs e)
{
    Microsoft.Office.Tools.Word.Action clickedAction =
        sender as Microsoft.Office.Tools.Word.Action;

    if (clickedAction != null)
    {
        clickedAction.Caption = "Display the location of " +
            e.Text;
    }
}
Private Sub DisplayAddress_BeforeCaptionShow(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ActionEventArgs) _
    Handles displayAddress.BeforeCaptionShow

    Dim clickedAction As Microsoft.Office.Tools.Word.Action = _
        TryCast(sender, Microsoft.Office.Tools.Word.Action)

    If clickedAction IsNot Nothing Then
        clickedAction.Caption = "Display the location of " & e.Text
    End If
End Sub

Remarks

This event gives you an opportunity to change the smart tag caption based on context.

Applies to