Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Custom mouse behavior (Read 1892 times)
richardpopple
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Jan 11th, 2006
Custom mouse behavior
Jan 11th, 2006 at 9:14am
Print Post  
Hello,

I'm looking to use MindFusion flowChart.Net as part of an app but I have a query about the user interface. We need to be able to set up the app so that, to create an arrow, the user left clicks once on a node and the arrow then remains attacted to the cursor, as the user moves it. To connect the arrow to another node the user left clicks over it. So far I've only been able to implement behaviour where by the user must hold down the left mouse button to connect arrows. Any help on how I might create this sort of behaviour would be appreciated.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom mouse behavior
Reply #1 - Jan 11th, 2006 at 9:54am
Print Post  
Hi,

The only way I can think of to do that is to handle the BoxClicked and MouseMove events like this:

Code
Select All
Arrow currentLink = null;

private void fc_BoxClicked(object sender, MindFusion.FlowChartX.BoxMouseArgs e)
{
  PointF mousePos = e.DocumentPos;

  if (currentLink == null)
  {
    currentLink = fc.CreateArrow(e.Box, mousePos);
    currentLink.Dynamic = true;
    fc.Capture = true;
  }
  else
  {
    currentLink.Destination = e.Box;
    currentLink = null;
    fc.Capture = false;
  }
}

private void fc_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
  if (currentLink != null)
  {
    PointF mousePos = fc.ClientToDoc(new Point(e.X, e.Y));

    currentLink.ControlPoints[currentLink.ControlPoints.Count - 1] = mousePos;
    currentLink.UpdateFromPoints();
    fc.Invalidate();
  }
}

 



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


I love YaBB 1G - SP1!

Posts: 4
Joined: Jan 11th, 2006
Re: Custom mouse behavior
Reply #2 - Jan 11th, 2006 at 10:08am
Print Post  
Thank you,

Yes I think that will do what I want.

Cheers Rich.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint