OleControl
OleFormat.OleControl property
获取OleControl
如果此 OLE 对象是 ActiveX 控件,则为对象。否则,此属性为 null。
public OleControl OleControl { get; }
例子
展示如何验证 ActiveX 控件的属性。
Document doc = new Document(MyDir + "ActiveX controls.docx");
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
OleControl oleControl = shape.OleFormat.OleControl;
Assert.AreEqual("CheckBox1", oleControl.Name);
if (oleControl.IsForms2OleControl)
{
Forms2OleControl checkBox = (Forms2OleControl)oleControl;
Assert.AreEqual("First", checkBox.Caption);
Assert.AreEqual("0", checkBox.Value);
Assert.AreEqual(true, checkBox.Enabled);
Assert.AreEqual(Forms2OleControlType.CheckBox, checkBox.Type);
Assert.AreEqual(null, checkBox.ChildNodes);
Assert.AreEqual(string.Empty, checkBox.GroupName);
// 请注意,您不能为 Frame 设置 GroupName。
checkBox.GroupName = "Aspose group name";
}
也可以看看
- class OleControl
- class OleFormat
- 命名空间 Aspose.Words.Drawing
- 部件 Aspose.Words