Edit this page

Drawing

The DrawTool is one of the tools that come out-of-the-box with the RadImageEditor and enables you to draw over the image. You can choose different brush color and size. The tool provides some customization options that are explained in detail in this topic.

Similarly to the other RadImageEditor tools, the DrawTool is located in the Telerik.Windows.Media.Imaging.Tools namespace, inherits the DrawToolBase class and can be defined in XAML as follows:

Example 1: Define DrawTool

<tools:DrawTool />

Modifying

The DrawTool introduces the following two properties which can be set by declaring them in XAML as well:

  • DefaultBrushSize: Specifies the default size of the brush. The property is of type double.

  • DefaultBrushColor: Specifies the default brush color. The property is of type Color.

Example 2: Customize DrawTool

<tools:DrawTool DefaultBrushColor="Blue" DefaultBrushSize="5"/>

Example 2: Customize DrawTool

DrawTool drawTool = new DrawTool();
drawTool.DefaultBrushColor = Colors.Blue;
drawTool.DefaultBrushSize = 5;
Dim drawTool = New DrawTool()
drawTool.DefaultBrushColor = Colors.Blue
drawTool.DefaultBrushSize = 5

Inheritance and Customizing

The DrawTool introduces the following virtual methods which can be overridden in order to achieve different than the default behavior:

  • CreatePathFigure(Point currentPosition): Returns a PathFigure object which is added to the path’s geometry figures collection. The method is invoked at the beginning of the drawing right after the Path’s initialization.

  • CreatePathSegment(Point currentPosition): Returns a PathSegment object which is added to the drawn path’s figure during the drawing. A LineSegment is inserted by default.

See Also