Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Managing DiagramLink.ControlPoints (Read 1572 times)
Bass
YaBB Newbies
*
Offline



Posts: 31
Joined: Aug 27th, 2010
Managing DiagramLink.ControlPoints
Jun 21st, 2011 at 7:37am
Print Post  
Hi Stoyan,

I was wondering if there is a property for a DiagramLink that could be set programmatically to override the Diagram.AllowSplitLinks.

For most links I do want the behavior that AllowSplitLinks dictates, but for some I dont. I checked the documentation, but I didnt see any event handlers for (adding, removing or..) changing control points of a link in order to "e.Cancel = true;" this operation as an alternative.

For now, I handle the Diagram.LinkModifying event and set e.Cancel to true if needed. But I have seen that at this time a control point can already be added to the collection by dragging the link. Canceling does stop the operation, but the point is already in.

Any ideas?

Regards,
Bas
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Managing DiagramLink.ControlPoints
Reply #1 - Jun 21st, 2011 at 8:22am
Print Post  
Hello Bas,

The only way to do that I can think of is to set AllowSplitLinks dynamically depending on what link is under the mouse pointer. Here's an example that disables AllowSplitLinks for the first link created by the user:

Code
Select All
private void diagramView_MouseMove(object sender, MouseEventArgs e)
{
	PointF mousePosition = diagramView.ClientToDoc(e.Location);
	DiagramLink link = diagram.GetLinkAt(
		mousePosition, Constants.GetLineHitTest(diagram.MeasureUnit));
	if (link != null && link.Selected)
	{
		diagram.AllowSplitLinks = (link != diagram.Links[0]);
		int temp = 0;
		if (diagram.AllowSplitLinks && !link.HitTestHandle(mousePosition, ref temp))
			diagramView.OverrideCursor = Cursors.VSplit;
		else
			diagramView.OverrideCursor = null;
	}
	else
	{
		diagramView.OverrideCursor = null;
	}
}
 



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