Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to select all visible nodes (Read 1238 times)
rdwheeler
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 15
Joined: May 28th, 2008
How to select all visible nodes
Aug 17th, 2010 at 7:26pm
Print Post  
I would like to programatically select all the nodes visible in a DiagramView.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to select all visible nodes
Reply #1 - Aug 18th, 2010 at 5:04am
Print Post  
Code
Select All
foreach (DiagramNode node in GetVisibleNodes(diagramView))
	node.Selected = true;

DiagramNodeCollection GetVisibleNodes(DiagramView view)
{
	DiagramNodeCollection nodes = new DiagramNodeCollection();
	RectangleF visibleRegion = view.ClientToDoc(view.ClientRectangle);
	foreach (DiagramNode node in view.Diagram.Nodes)
	{
		if (node.Bounds.IntersectsWith(visibleRegion))
			nodes.Add(node);
	}
	return nodes;
} 

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint