Is it possible to get a list of the nodes in a diagram in order of their position in the Z-Order?
Is it possible to get a list of the nodes in a diagram in order of their position in the Z-Order?
Accessing the diagram's child nodes through the model layers will let you get hold of the nodes according to their Z-order. Populating the 'nodesInZOrder' list in the manner shown below will set it up with the diagram's child nodes in order of increasing Z-order, i.e., the bottom-most node will be the first item in the list while the topmost node will be the last.
C#
ArrayList nodesInZOrder = new ArrayList();
foreach (Layer layer in this.diagramComponent.Model.Layers)
{
IEnumerator inodes = layer.GetEnumerator();
while (inodes.MoveNext())
{
nodesInZOrder.Add(inodes.Current);
}
}
VB
Dim nodesInZOrder As ArrayList = New ArrayList()
Dim layer As Layer
For Each layer In Me.diagramComponent.Model.Layers
Dim inodes As IEnumerator = layer.GetEnumerator()
While inodes.MoveNext()
nodesInZOrder.Add(inodes.Current)
End While
Next
Conclusion
I hope you enjoyed learning about whether it is possible to get a list of the nodes in a diagram in order of their position in the Z-Order.
You can refer to WinForms Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms Diagram example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!