We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

ConnectionPoint Mouse Move

Dear Support,
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

7 Replies

MW Melba Winshia Syncfusion Team March 30, 2010 12:52 PM UTC

Hi 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




JD Johan De Mulder December 6, 2013 06:17 PM UTC

Moving the port when the mouse moves over it works. But how do you select a port by clicking on it, then move it to a new position and release the mouse (similar to a node).

1. Mouse down (on the Connectionpoint) -> selection ConnectionPoint
2. Move mouse -> move (redrawing the ConnectionPoint on the Mouse Pointer)
3. Mouse up -> reposition


AK Ashok Kumar V Syncfusion Team December 10, 2013 07:37 AM UTC

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


JD Johan De Mulder December 13, 2013 04:13 PM UTC

Hello Ashok,

The video in the attached sample looks like a good alternative to move a certain port.
However the code that is included in the zip file does not correspond with what is demonstrated in the video. The code shows how to add additional ports.

Can you please provide the code that corresponds with the video?

Best regards,
Johan


AK Ashok Kumar V Syncfusion Team December 30, 2013 11:13 AM UTC

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.



DA david adele February 20, 2018 09:19 AM UTC

Interesting


NG Naganathan Ganesh Babu Syncfusion Team February 21, 2018 12:47 PM UTC

Hi Johan, 
 
Thanks for the update  
 
Please let us know whether you need any assistance  
 
Regards, 
 
Naganathan K G 


Loader.
Live Chat Icon For mobile
Up arrow icon