Forms2OleControl class

Represents Microsoft Forms 2.0 OLE control.

public abstract class Forms2OleControl : OleControl


Name Description
Caption { get; } Gets Caption property of control. Default value is an empty string.
ChildNodes { get; } Gets collection of immediate child controls.
Enabled { get; } Returns true if control is in enabled state.
override IsForms2OleControl { get; }
Name { get; } Gets name of the ActiveX control.
Type { get; } Gets type of Forms 2.0 control.
Value { get; } Gets underlying Value property which often represents control state. For example checked option button has ‘1’ value while unchecked has ‘0’. Default value is an empty string.


Shows how to verify the properties of an ActiveX control.

Document doc = new Document(MyDir + "ActiveX controls.docx");

Shape shape = (Shape) doc.GetChild(NodeType.Shape, 0, true);
OleControl oleControl = shape.OleFormat.OleControl;

Assert.AreEqual(null, oleControl.Name);

if (oleControl.IsForms2OleControl)
    Forms2OleControl checkBox = (Forms2OleControl) oleControl;
    Assert.AreEqual("Первый", checkBox.Caption);
    Assert.AreEqual("0", checkBox.Value);
    Assert.AreEqual(true, checkBox.Enabled);
    Assert.AreEqual(Forms2OleControlType.CheckBox, checkBox.Type);
    Assert.AreEqual(null, checkBox.ChildNodes);

See Also