Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Create box instead of drawing arrow (Read 3609 times)
T.Pascal
Guest


Create box instead of drawing arrow
Mar 13th, 2006 at 8:28am
Print Post  
hi,
i'd like over certain box to create box instead of drawing arrow and attach those box to the one i created on. And if the box created execed the limit of the box we created on, resize the box we create on. (the box shape have to be the one selected on the shapeToolBar)

thx.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Create box instead of drawing arrow
Reply #1 - Mar 13th, 2006 at 10:06am
Print Post  
Hi,

You could change the flowchart.Behavior from the MouseMove event handler, depending on whether the container box is pointed by the mouse;

Code
Select All
private void fc_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
  if (e.Button == MouseButtons.None)
  {
    PointF mousePos = fc.ClientToDoc(new Point(e.X, e.Y));

    // get the box under the mouse cursor
    Box aBox = fc.GetNodeAt(mousePos, true, true) as Box;
    if (aBox != null && aBox.Tag.ToString() == "the special box")
	fc.Behavior = BehaviorType.CreateBox;
    else
	fc.Behavior = BehaviorType.FlowChart;
  }
}
 



Then in BoxCreated check whether

containerBox.BoundingRect.Contains(e.Box.BoundingRect)

and if it doesn't - enlarge the container box.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
T.Pascal
Guest


Re: Create box instead of drawing arrow
Reply #2 - Mar 13th, 2006 at 11:29am
Print Post  
after had had written this
Code
Select All
Private Sub fc_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
	  If e.Button = MouseButtons.None Then
		Dim point As New point(e.X, e.Y)
		Dim mousePos As New PointF
		Dim aBox As Box
		mousePos = fc.ClientToDoc(point)
		aBox = fc.GetNodeAt(mousePos, True, True)
		If aBox.Shape.Id = "ExternalOrganization" Then
		    fc.Behavior = BehaviorType.CreateBox
		Else : fc.Behavior = BehaviorType.FlowChart
		End If
	  End If
    End Sub 



i still drawing arrow Sad
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Create box instead of drawing arrow
Reply #3 - Mar 13th, 2006 at 12:17pm
Print Post  
One of the True arguments passed to GetNodeAt means that locked objects are excluded from the search. Is that ExternalOrganization node locked by any chance ?

Stoyan
  
Back to top
 
IP Logged
 
T.Pascal
Guest


Re: Create box instead of drawing arrow
Reply #4 - Mar 13th, 2006 at 12:39pm
Print Post  
sorry,
the ExternalOrganization node is not locked
and when i move the mouse over ExternalOrganization node , the "arrow" display change to "hand" display as usealy when draw an arrow
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Create box instead of drawing arrow
Reply #5 - Mar 13th, 2006 at 12:44pm
Print Post  
The other True argument excludes selected items from search - is it selected by any chance ? Could you display aBox.Shape.Id in the status bar or in some box to see whether its value changes while the mouse moves?
  
Back to top
 
IP Logged
 
T.Pascal
Guest


Re: Create box instead of drawing arrow
Reply #6 - Mar 13th, 2006 at 1:18pm
Print Post  
i resolve the drawing problem

Private Sub fc_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles fc.MouseMove

the hanldles was missing , that why the code wasn't use.

  
Back to top
 
IP Logged
 
T.Pascal
Guest


Re: Create box instead of drawing arrow
Reply #7 - Mar 14th, 2006 at 7:28am
Print Post  
the container auto-resize work , but i don't know how to locked the box on the container , so if we move the container, all the boxes in it move to. ???
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Create box instead of drawing arrow
Reply #8 - Mar 14th, 2006 at 10:40am
Print Post  
Hi,

Try calling

aBox.AttachTo(container, ...)

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