共用方式為


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

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

See Also

Reference

ShapeElement Class

Microsoft.VisualStudio.Modeling.Diagrams Namespace