Forms2OleControlCollection

Forms2OleControlCollection class

Stellt eine Sammlung von darForms2OleControl Objekte.

Um mehr zu erfahren, besuchen Sie dieArbeiten mit Ole-Objekten Dokumentationsartikel.

public class Forms2OleControlCollection : IEnumerable<Forms2OleControl>

Konstrukteure

NameBeschreibung
Forms2OleControlCollection()Default_Constructor

Eigenschaften

NameBeschreibung
Count { get; }Ruft die Anzahl der Objekte in der Sammlung ab.
Item { get; }Ruft abForms2OleControl Objekt an einem angegebenen Index.

Methoden

NameBeschreibung
GetEnumerator()Ruft den Enumerator ab.

Beispiele

Zeigt, wie auf ein in ein Dokument eingebettetes OLE-Steuerelement und seine untergeordneten Steuerelemente zugegriffen wird.

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

// Formen speichern und zeigen OLE-Objekte im Hauptteil des Dokuments an.
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);

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

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

// Einige OLE-Steuerelemente enthalten möglicherweise untergeordnete Steuerelemente, z. B. das in diesem Dokument mit drei Optionsschaltflächen.
Forms2OleControlCollection oleControlCollection = oleControl.ChildNodes;

Assert.AreEqual(3, oleControlCollection.Count);

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

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

Assert.AreEqual("Delphi", oleControlCollection[2].Caption);
Assert.AreEqual("0", oleControlCollection[2].Value);

Siehe auch