ConnectionPoint Mouse Move
I need help to change the position of a ConnectionPoint of a symbol using the mouse. I'm trying to implement follows steps.
1. Mouse down (on the Connectionpoint) -> selection ConnectionPoint
2. Move mouse -> move (redrawing the ConnectionPoint on the Mouse Pointer)
3. Mouse up -> reposition
Is there an example where I can find ideas
Thank You
Best Regards
Domenico
Thank you for your interest in Syncfusion Products.
Please use below code to change the position of a ConnectionPoint of symbol using the mouse:
[C#]
private void diagram1_MouseMove(object sender, MouseEventArgs e)
{
PointF mouseLocation = diagram1.Controller.ConvertToModelCoordinates(e.Location);
Node nd = diagram1.Controller.GetNodeAtPoint(mouseLocation);
if (nd != null)
{
ConnectionPoint cp = HandlesHitTesting.GetConnectionPointAtPoint(nd, mouseLocation);
if (cp != null)
{
Cursor.Current = Cursors.Hand;
cp.Position = Position.Custom;
PointF portLocation = nd.ConvertToNodeCoordinates(mouseLocation);
cp.OffsetX = portLocation.X;
cp.OffsetY = portLocation.Y;
}
}
}
Please let me know if this helps.
Thanks,
Melba
2. Move mouse -> move (redrawing the ConnectionPoint on the Mouse Pointer)
3. Mouse up -> reposition
Hi Johan,
Thanks for your interest in Syncfusion product.
We regret to inform you that we don’t have support to select and move the connection point like node.
However, we suggest you to activate “ConnectionPointTool” to move the Connection point to the
required location.
Please refer the below code snippet.
[C#]
private void Form1_Load(object
sender, EventArgs e)
{
OrthogonalConnector
connect = new OrthogonalConnector(new PointF(100,
200), new PointF(400,
200));
ConnectionPoint
cp = new ConnectionPoint();
cp.VisualType = PortVisualType.Triangleport;
cp.Size = 20;
connect.Ports.Add(cp);
diagram1.Model.AppendChild(connect);
}
private
void button1_Click(object
sender, EventArgs e)
{
diagram1.Controller.ActivateTool("ConnectionPointTool");
}
private
void button2_Click(object
sender, EventArgs e)
{
diagram1.Controller.DeactivateTool(diagram1.Controller.ActiveTool);
}
Please try the below attached
sample and let us know if you have any queries.
Regards,
Ashok Kumar.
Forum_93638_edacd315.zip
Hi Johan,
Thanks for your update.
Please note that the connection point tool is an interactive tool for inserting, deleting and moving the
connection points on diagram nodes. You can insert a connection point by clicking the node and delete a
connection point by holding CTRL and clicking the node. Also, you can move the connection point by
pressing the left mouse click over the connection point and dragged to the required location. Here is the
documentation link for
your reference.
Link: http://help.syncfusion.com/ug/windows%20forms/diagram/documents/diagrambuilder.htm
Please let us know if you have any queries.
Thanks,
Ashok Kumar.
- 7 Replies
- 6 Participants
-
DM Domenico Mozzone
- Mar 25, 2010 03:37 PM UTC
- Feb 21, 2018 12:47 PM UTC