Action.BeforeCaptionShow 事件 (2007 系統)

更新:2007 年 11 月

在使用者按一下智慧標籤圖示之後,顯示智慧標籤功能表之前發生。

命名空間:  Microsoft.Office.Tools.Word
組件:  Microsoft.Office.Tools.Word.v9.0 (在 Microsoft.Office.Tools.Word.v9.0.dll 中)

語法

Public Event BeforeCaptionShow As BeforeCaptionShowEventHandler

Dim instance As Action
Dim handler As BeforeCaptionShowEventHandler

AddHandler instance.BeforeCaptionShow, handler
public event BeforeCaptionShowEventHandler BeforeCaptionShow

備註

此事件可讓您根據內容變更智慧標籤的標題。

如需處理事件的詳細資訊,請參閱使用事件

範例

下列程式碼範例將示範 BeforeCaptionShow 事件的處理常式。事件處理常式會修改動作的功能表標題。這個程式碼範例是 Action 類別完整範例的一部分。

這是示範文件層級自訂的範例。

Private Sub OpenMessageBox_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
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;
    }
}

使用權限

請參閱

參考

Action 類別

Action 成員

Microsoft.Office.Tools.Word 命名空間