ShapeElement.IterateShapes Method
Iterates through a shape and its child shapes.
Namespace: Microsoft.VisualStudio.Modeling.Diagrams
Assembly: Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0.dll)
Syntax
'宣言
Public Overridable Sub IterateShapes ( _
iterator As IShapeIterator _
)
public virtual void IterateShapes(
IShapeIterator iterator
)
public:
virtual void IterateShapes(
IShapeIterator^ iterator
)
abstract IterateShapes :
iterator:IShapeIterator -> unit
override IterateShapes :
iterator:IShapeIterator -> unit
public function IterateShapes(
iterator : IShapeIterator
)
Parameters
- iterator
Type: Microsoft.VisualStudio.Modeling.Diagrams.IShapeIterator
The iterator to use with the shape.
Remarks
This method recursively goes through all child shapes that are assigned to the shape and calls the iterator when each child shape is encountered. By default, the traversal is depth first, and nested child shapes are iterated before relative child shapes.
Examples
protected virtual void CheckForOrphanedShapes(DslDiagrams::Diagram diagram, DslModeling::SerializationResult serializationResult)
{
global::System.Collections.Generic.List<DslDiagrams::ShapeElement> orphanedShapes = new global::System.Collections.Generic.List<DslDiagrams::ShapeElement>();
diagram.IterateShapes(new OrphanedShapeIterator(orphanedShapes, diagram));
foreach (DslDiagrams::ShapeElement orphanedShape in orphanedShapes)
{
if (serializationResult.Failed)
break;
orphanedShape.OnOrphaned(serializationResult);
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.