Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to stop resizing a node when define it by mouse? (Read 1156 times)
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
How to stop resizing a node when define it by mouse?
Nov 14th, 2012 at 3:29am
Print Post  
There 3 steps below:

1.Hold left button of mouse and move mouse to define a new node
2.Release button
3.NodeCreated event will be fired and my code will do something.

The type of new node is XXX (I mean that it is a new type).
After created this node user can not resize it by mouse.
Because I write these code below in the construction method

this.Constraints.MinHeight = EMActorShape.DefaultHeight;
this.Constraints.MinWidth = EMActorShape.DefaultWidth;

It can work well, user can not resize it exactly. But in the step
1, when use define it, user still can use mouse to resize it. In the
NodeCreated event handler, the size of new node is as same as the size
when user release left button.

So my question is how to stop user resize a new node when use define
it ?

Thanks a lot.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to stop resizing a node when define it by mouse?
Reply #1 - Nov 14th, 2012 at 10:10am
Print Post  
You could set the constraints from an InitializeNode event handler or from your custom node type constructor:

Code
Select All
private void diagram_InitializeNode(object sender, NodeEventArgs e)
{
	e.Node.Constraints.MinHeight = 30;
	e.Node.Constraints.MinWidth  = 30;
} 



This should make them apply when the user starts initial drawing. It looks a bit unnatural though - you could create nodes with a fixed size from diagram.Clicked handler instead, and prevent interactive handler by setting Behavior to DrawLinks or Modify.

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