Hi
You should use the
IGraphNode Interface to accomplish what you are seeking. Run
this sample and add a few Symbols and Links. Select a Symbol and click on the "Change Link Colors" button.
Here is the code snippet which changes the colors of the links coming into and leaving out of the selected instance of MySymbol:
if ((this.diagram1.SelectionList.Count == 1) || (this.diagram1.SelectionList.First.GetType() == typeof(MySymbol)))
{
IGraphNode curNode = this.diagram1.SelectionList.First as IGraphNode;
if (curNode != null)
{
IEnumerator enumedgesEntering = curNode.EdgesEntering.GetEnumerator();
IEnumerator enumedgesLeaving = curNode.EdgesLeaving.GetEnumerator();
//Incoming Links - Blue
ICollection edgesEntering = curNode.EdgesEntering;
while (enumedgesEntering.MoveNext())
{
Link incomingLink = enumedgesEntering.Current as Link;
incomingLink.LineStyle.LineColor = Color.Blue;
}
//Incoming Links - Blue
ICollection edgesLeaving = curNode.EdgesLeaving;
while (enumedgesLeaving.MoveNext())
{
Link leavingLink = enumedgesLeaving.Current as Link;
leavingLink.LineStyle.LineColor = Color.Red;
}
this.diagram1.Refresh();
}
}
Regards
Arun