共用方式為


Button.Activate 方法

啟動 Button

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

語法

'宣告
Public Sub Activate
public void Activate()

範例

下列程式碼範例會將兩個 Button 控制項加入文件,然後使用 Activate 方法以程式執行方式啟動第一個按鈕。

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

Private Sub ActivateControl()
    Dim Button1 As Microsoft.Office.Tools.Word.Controls.Button = _
        Me.Controls.AddButton(25, 25, 80, 30, "Button1")
    Button1.Text = "Button 1"

    Dim Button2 As Microsoft.Office.Tools.Word.Controls.Button = _
        Me.Controls.AddButton(25, 100, 80, 30, "Button2")
    Button2.Text = "Button 2"

    ' Programmatically activate the first button.
    Button1.Activate()
End Sub
private void ActivateControl()
{
    Microsoft.Office.Tools.Word.Controls.Button button1 =
        this.Controls.AddButton(25, 25, 80, 30, "button1");
    button1.Text = "Button 1";

    Microsoft.Office.Tools.Word.Controls.Button button2 =
        this.Controls.AddButton(25, 100, 80, 30, "button2");
    button2.Text = "Button 2";

    // Programmatically activate the first button.
    button1.Activate();
}

.NET Framework 安全性

請參閱

參考

Button 類別

Microsoft.Office.Tools.Word.Controls 命名空間