Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ControlNode dynamic drawing problem? (Read 2291 times)
Taivan
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 37
Joined: Jun 15th, 2012
ControlNode dynamic drawing problem?
Jun 28th, 2012 at 7:00am
Print Post  
I have Diagram and ControlNode. ControlNodes drawing runtime. My problem:

For example :

One ControlNode create first time. it is base node of all node.
Right click the ControlNode show Popupmenu.
Popmenu items : 1.Left, 2.Right, 3.Up, 4.Down.

If i click 1.Left it create node left side on the base node. And click again 1.Left
then create next node on left side. But new created nodes are matching first left
side node.

How i draw custom node run time in nice queue?

See picture?



  

Untitled.jpg ( 286 KB | 170 Downloads )
Untitled.jpg
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ControlNode dynamic drawing problem?
Reply #1 - Jun 28th, 2012 at 10:03am
Print Post  
Creating a node to the left of another node should look like this:

Code
Select All
ControlNode baseNode = ...;
double dist = 30;
var rect = baseNode.Bounds;
rect.X -= rect.Width + dist;

var newNode = new ControlNode();
newNode.Bounds = rect;
diagram.Nodes.Add(newNode); 



Replace the rect.X assignment with the following for the other cases:

Code
Select All
// right
rect.X += rect.Width + dist;

// up
rect.Y -= rect.Height + dist;

// down
rect.Y += rect.Height + dist; 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint