EnabledCentralPort to false by default

Hi,

is it possible by default, when you select LineTool, that the property EnabledCentralPort will ALWAYS be false?

Another question, I want the RectangleTool, always by default, draw a rectangle without color. It is a problem for me that the FillStyle in rectangle is yellow by default.

Thanks in advance for your help.


3 Replies

BM Bala Murugan A.S Syncfusion Team December 30, 2010 08:55 AM UTC

Hi Blanca,

Thanks for using Syncfusion Products.

Diagram control has support to customize its Tools by deriving the appropriate Tool class. We suggest you to create your own Custom Tool and override its CreateNode method to customize the node inorder to achieve your requirements.

We have customize the LineTool and RectangleTool to meet your requirements, please refer the below code snippet.

LineTool:

[C#]
class MyLineTool:LineTool
{
public MyLineTool(DiagramController controller): base(controller)
{
this.Name = "MyLineTool";
}
protected override Node CreateNode(PointF ptStart, PointF ptEnd)
{
LineBase toReturn = new Line(new PointF[] { ptStart, ptEnd });
toReturn.EditStyle.DefaultHandleEditMode = HandleEditMode.Vertex;
SetDecorator(toReturn);

//Setting EnableCentralPort to false by default
toReturn.EnableCentralPort = false;

return toReturn;
}
}

RectangleTool:

[C#]
class MyRectTool:RectangleTool
{
public MyRectTool(DiagramController controller)
: base(controller)
{
this.Name = "MyRectTool";
}
protected override Node CreateNode(RectangleF rectBounding)
{
Syncfusion.Windows.Forms.Diagram.Rectangle rect=new Syncfusion.Windows.Forms.Diagram.Rectangle(rectBounding);

//Drawing a rectangle without color by default
rect.FillStyle.Color = Color.Transparent;
return rect;
}
}

We have prepared a simple sample to demonstrate this and the same can be downloaded from the below link,
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=LineTool_RectangleToolDemo1968239555.zip

Please try the above sample and let me know if it helps.

Regards,
Bala Murugan A.S



BC Blanca Calderon January 3, 2011 10:24 AM UTC

Thanks, it works fine!



BM Bala Murugan A.S Syncfusion Team January 4, 2011 08:40 AM UTC

Hi Blanca,

Thanks for the update.

Please let me know if you have any concerns and we will be happy to help you out.

Regards,
Bala Murugan A.S


Loader.
Up arrow icon