Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to change nodes' location as proportional (Read 1240 times)
kdr35
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 14
Joined: Aug 12th, 2010
How to change nodes' location as proportional
Sep 1st, 2010 at 9:34am
Print Post  
I want to change nodes' location as proportional in two ways (expand and collapse)

Such as  changing nodes' location for expanding operation;







thanks...
« Last Edit: Sep 1st, 2010 at 10:38am by kdr35 »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to change nodes' location as proportional
Reply #1 - Sep 1st, 2010 at 12:17pm
Print Post  
Try this method:
Code
Select All
private void Expand(PointF center, float scale)
{
	foreach (DiagramNode node in diagram.Nodes)
	{
		PointF nodePos = node.GetCenter();
		PointF newPos = new PointF(
			center.X + (nodePos.X - center.X) * scale,
			center.Y + (nodePos.Y - center.Y) * scale);
		node.Bounds = RectangleF.FromLTRB(
			newPos.X - node.Bounds.Width / 2,
			newPos.Y - node.Bounds.Height / 2,
			newPos.X + node.Bounds.Width / 2,
			newPos.Y + node.Bounds.Height / 2);
	}
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
kdr35
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 14
Joined: Aug 12th, 2010
Re: How to change nodes' location as proportional
Reply #2 - Sep 1st, 2010 at 2:17pm
Print Post  
thanks...
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint