Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Highlighting Nodes Attached to Links (Read 372 times)
Nobu
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Nov 27th, 2023
Highlighting Nodes Attached to Links
Feb 16th, 2024 at 11:02am
Print Post  
How do I highlight a node attached to a link?

The nodes attached to the link are ControlNode and CompositeNode.

---
Tried and tested method:
When the link is selected, set the property (Selected) of the node attached to the link to true.
However, the LinkModifying event does not occur and I cannot move the destination or source of the connection.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3204
Joined: Oct 19th, 2005
Re: Highlighting Nodes Attached to Links
Reply #1 - Feb 16th, 2024 at 11:55am
Print Post  
Once you select multiple items, you get SelectionMoving event when they are moved, and links' origin / destination cannot change through a multiple-selection. You could draw highlights from DrawForeground event handler instead of selecting attached nodes:

Code
Select All
void OnDrawForeground(object sender, DiagramEventArgs e)
{
	foreach (var link in diagram.Selection.Links)
	{
		if (link.SubordinateGroup != null)
		{
			foreach (var attached in link.SubordinateGroup.AttachedNodes)
			{
				var rect = attached.Bounds;
				rect.Inflate(2, 2);
				e.Graphics.DrawRectangle(Pens.Green, rect);
				//or attached.DrawHandles()
			}
		}
	}
} 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Nobu
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Nov 27th, 2023
Re: Highlighting Nodes Attached to Links
Reply #2 - Feb 16th, 2024 at 2:28pm
Print Post  
I tried it as soon as possible.
It works as expected.

Regards,
Nobu.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint