Forms2OleControlCollection

Forms2OleControlCollection class

Represents collection of Forms2OleControl objects.

To learn more, visit the Working with Ole Objects documentation article.

public class Forms2OleControlCollection : IEnumerable<Forms2OleControl>

Constructors

NameDescription
Forms2OleControlCollection()The default constructor.

Properties

NameDescription
Count { get; }Gets count of objects in the collection.
Item { get; }Gets Forms2OleControl object at a specified index.

Methods

NameDescription
GetEnumerator()Gets enumerator.

Examples

Shows how to access an OLE control embedded in a document and its child controls.

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

// Shapes store and display OLE objects in the document's body.
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);

Assert.That(shape.OleFormat.Clsid.ToString(), Is.EqualTo("6e182020-f460-11ce-9bcd-00aa00608e01"));

Forms2OleControl oleControl = (Forms2OleControl)shape.OleFormat.OleControl;

// Some OLE controls may contain child controls, such as the one in this document with three options buttons.
Forms2OleControlCollection oleControlCollection = oleControl.ChildNodes;

Assert.That(oleControlCollection.Count, Is.EqualTo(3));

Assert.That(oleControlCollection[0].Caption, Is.EqualTo("C#"));
Assert.That(oleControlCollection[0].Value, Is.EqualTo("1"));

Assert.That(oleControlCollection[1].Caption, Is.EqualTo("Visual Basic"));
Assert.That(oleControlCollection[1].Value, Is.EqualTo("0"));

Assert.That(oleControlCollection[2].Caption, Is.EqualTo("Delphi"));
Assert.That(oleControlCollection[2].Value, Is.EqualTo("0"));

See Also