CommandButtonControl

CommandButtonControl class

CommandButton 控件运行一个宏,当用户单击它时,该宏会执行某个操作。

public class CommandButtonControl : Forms2OleControl

构造函数

姓名描述
CommandButtonControl()初始化一个新的实例CommandButtonControl类.

特性

姓名描述
BackColor { get; set; }获取或设置控件的背景颜色。 默认值取决于控件的类型。
Caption { get; set; }获取或设置控件的 Caption 属性。 默认值为空字符串。
virtual ChildNodes { get; }获取直接子控件的集合。
Enabled { get; }返回真的如果控制处于启用状态。
ForeColor { get; set; }获取或设置控件的前景色。 默认值取决于控件的类型。
GroupName { get; set; }获取或设置指定一组互斥控件的字符串。 默认值为空字符串。
Height { get; set; }获取或设置控件的高度(以点为单位)。
IsForms2OleControl { get; }返回真的如果控件是Forms2OleControl.
Name { get; set; }获取或设置 ActiveX 控件的名称。
override Type { get; }获取 Forms 2.0 控件的类型。
Value { get; }获取通常代表控制状态的底层 Value 属性。 例如,选中的选项按钮的值为“1”,而未选中的选项按钮的值为“0”。 默认值为空字符串。
Width { get; set; }获取或设置控件的宽度(以点为单位)。

例子

展示如何插入 ActiveX 控件。

DocumentBuilder builder = new DocumentBuilder();

CommandButtonControl button1 = new CommandButtonControl();
Shape shape = builder.InsertForms2OleControl(button1);
Assert.AreEqual(Forms2OleControlType.CommandButton, button1.Type);

也可以看看