Restricting tool activity

Can we make a tool inactive in certain place of the diagram? I need to be able to draw circles on upper left corner of the diagram control. for eg) If diagram control is 100X100 pixels size, I need to restrict drawing of circles only on top left 50X50 pixels.


1 Reply

PM Pandi Murugan A Syncfusion Team August 15, 2011 12:46 PM UTC

Hi JVM,

Thanks for using Syncfusion products and sorry for the delay in getting back to you.

You can achieve your requirement by aborting the drawing tool. Here is the code snippet for your reference.

[C#]
diagram1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.diagram1_MouseMove);
private void diagram1_MouseMove(object sender, MouseEventArgs e)
{
EllipseTool tool = diagram1.Controller.ActiveTool as EllipseTool;
if (tool != null)
{
PointF curPt = diagram1.Controller.ConvertToModelCoordinates(e.Location);
if (curPt.X > 50 || curPt.Y > 50)
{
tool.Abort();
diagram1.Refresh();
}
}
}


Please let me know if you have any concerns.

Regards,
Pandi Murugan A


Loader.
Up arrow icon