Custom ConnectionPoint

Dear Support,
I'm trying to draw a custom ConnectionPoint. I mean a ConnectionPoint with a my own shape.
I tried to set the property ConnectionPoint.VisualType = PortVisualType.Custom and then to assign the ConnectionPoint.GraphicsPath to have my conncetion point shape, but I miss something as the custom connectionpoint is not visible on the node.
To set the Custom Cconnectionpoint color I used the FillStyle property.

Thank you
Best Regards
Domenico

3 Replies

DM Domenico Mozzone March 27, 2010 07:21 AM UTC

A clarification
setting Connectionpoint properties as explained in my post the result is a Connectionpoint with X symbol.
Best Regard
Domenico Mozzone


MW Melba Winshia Syncfusion Team March 29, 2010 01:23 PM UTC

Hi Domenico,

Thank you for your interest in Syncfusion Products.

Please use below code to draw a custom ConnectionPoint:

[C#]

private void Form1_Load(object sender, EventArgs e)
{
Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(100, 100, 100, 100);
rect.EnableCentralPort = false;
ConnectionPoint cp = new ConnectionPoint();
cp.Position = Position.MiddleRight;
cp.VisualType = PortVisualType.Custom;
cp.GraphicsPath = CustomShape();
rect.Ports.Add(cp);
this.diagram1.Model.AppendChild(rect);
this.diagram1.Controller.ActivateTool("LineLinkTool");
}

private GraphicsPath CustomShape()
{
GraphicsPath gp = new GraphicsPath();
Size szText = TextRenderer.MeasureText("$", new Font(FontFamily.GenericSansSerif, 12));
gp.AddString("$", FontFamily.GenericSansSerif, 1, 12, new Point(-szText.Width / 2, -szText.Height / 2), new StringFormat(StringFormatFlags.NoWrap));
return gp;
}

Please let me know if this helps.

Thanks,
Melba



DM Domenico Mozzone April 6, 2010 08:48 AM UTC

Thank you Melba,
your example helped me in finding that the problem was related to my graphicpath.
Have a nice day
Best Regards
Domenico Mozzone

Loader.
Up arrow icon