Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Question about SetBounds method (Read 2198 times)
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Question about SetBounds method
Mar 14th, 2014 at 7:01pm
Print Post  
There are 2 node shapes, named Main and Sub. And I attach Sub to Main. When I move Main, Sub can follow Main, it can work well. But when I resize Main, Sub can not follow Main correctly.

For example:
Before resize Main, Main and Sub is closed, border by border. Then call SetBounds to resize Main then Sub can move a distance but these two shapes are not border by border. When I call SetBounds method I pass true value to second parameter.

How to solve this problem, thanks a lot.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Question about SetBounds method
Reply #1 - Mar 17th, 2014 at 7:11am
Print Post  
Try attaching Sub to Main like this:

Code
Select All
Sub.Bounds = Main.Bounds;
Sub.AttachTo(Main,
    GroupAnchorStyles.Left |
    GroupAnchorStyles.Top |
    GroupAnchorStyles.Right |
    GroupAnchorStyles.Bottom); 



This works like Control.Anchor property in Windows Forms, where resizing a container control also resizes children, keeping initial distances between some edges of the controls depending on the AnchorStyles flags set.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Re: Question about SetBounds method
Reply #2 - Jun 19th, 2014 at 10:45pm
Print Post  
sub will be resized as well. I want sub shape keep same size.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Question about SetBounds method
Reply #3 - Jun 20th, 2014 at 7:34am
Print Post  
Try something like AttachTo(node, AttachToNode.TopRight) if you want the subordinate node to keep fixed distance from a specific corner of the master node.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint