This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, Is that any ways to count the number of the specific node element in the diagramSurface. I am trying to use the diagram.Nodes.Count, however this is used to count all the nodes in the diagramSurface without consider the types of nodes. On the other hand, can we modify the location of the textbox on the connection flow to center? Thank a lots for your help! Regards, Janice. |
|
|
Hello Janice For your first point here, the DiagramSurface currently does not provide a way of counting a specific type of node. You'll just need to write a foreach loop that iterates through the diagram.Nodes collection and checks the type of each node. If the type matches the type of the node your counting, then increase some kind of count variable. For your second point, yes you can change the position of the TextBox on a connection. This can be done by making your own style for connection elements. Give this a try and let me know if you run into trouble. Regards - Jason |
|
|
By the way, regarding counting specific types of nodes, you can avoid writing the foreach loop by using LINQ: int countOfProcessNodes = diagram.Nodes.OfType<ProcessNode>().Count(); |
|
|
Hi Jason, So sorry to disturb you again. Can you guide me the ways to implement the foreach part? And where should i get the diagram.Nodes collection? Thank a lots for your help. Regards, Janice |
|
|
Hi ivan, Thank for your suggestion. But i can get the OfType<ProcessNode> in my system, is that i less something? Thank you. Regards, Janice. |
|
|
OfType requires you to import the LINQ operators, which you do by adding a using System.Linq; directive at the top of your code file. This in turn requires that you be targeting .NET 3.5. If you are not targeting .NET 3.5 then as Jason says you'll need to write a loop to count the elements. You can get the diagram from DiagramSurface.Diagram: int count = 0; |
|
|
Hi ivan, This is what i needed in my system. Thank you! Regards, Janice.
|
|