Button.Select 方法

选择 Button

命名空间:  Microsoft.Office.Tools.Word.Controls
程序集:  Microsoft.Office.Tools.Word.v4.0.Utilities(在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)

语法

声明
Public Sub Select
public void Select()

示例

下面的代码示例将两个 Button 控件添加到文档,然后通过使用 Select 方法以编程方式选择第一个按钮。

此示例针对的是文档级自定义项。

Private Sub SelectControl()
    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 select the first button.
    Button1.Select()
End Sub
private void SelectControl()
{
    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 select the first button.
    button1.Select();
}

.NET Framework 安全性

请参见

参考

Button 类

Select 重载

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