How can I create a customised RectangleTool?
Basically I want the user to select my customised tool and, when the rectangle has been drawn, display a bitmap inside the rectangle.
I started by creating a class that inherited from RectangleTool (in a similar way to creating custom symbols) but can not find any documentation on how to do this.
Would it be possible to supply me with a quick example of how this can be acheived.
ADAdministrator Syncfusion Team June 16, 2004 04:13 PM UTC
It is possible to define a custom tool to draw a rectangle shape and then display a BitmapNode inside the rectangle. Attached is a modified version of the Essential Diagram ''DynamicSymbol'' sample that uses a custom tool to draw a Rectangle shape with an image. The CustomRectTool class, a derivative of the Diagram.RectangleTool Tool type, demonstrates two different approaches for drawing the bitmap. The default is to display the bitmap image within the Rectangle shape as a Texture Fill Type. When using the FillStyle option the image will be an integral part of the outer shape and will act as a single node.
You can also display the image as a separate BitmapNode object that is located over the Rectangle shape. This option is demonstrated through the CustomRectTool.DisplayImageAsNode property. In this the case however the two nodes, the rectangle shape and the image, will behave as two distinct objects and will not act like a single node ie., selecting and moving the rectangle node will not move the bitmap node inside of it and vice versa.
Another option here would be to use a custom symbol with a Rectangle shape and a BitmapNode added as it''s child nodes. The InsertSymbolTool can then be used to create this custom symbol type as demonstrated in the DynamicSybmol sample.