This property sets whether or not the custom brush is enabled.
Property Value
True: The custom brush is enabled
False: The custom brush is not enabled
Default value is False
Explanation
The CustomBrushEnabled property sets whether or not the custom brush is enabled.
To enable the custom brush, set this property and the Fill property to True.
By setting this property to True, not only is the custom brush enabled for drawing, but the custom brush can be saved into an annotation file and loaded from an annotation file. Even if the object is drawn and read with CustomBrushEnabled property set to True, if it is set to False after drawing and reading, the object will be displayed with a solid fill pattern set by the BackColor property. However, setting the CustomBrushEnabled property to True again will enable the custom fill to be displayed.
Even when CustomBrushEnabled property is set to False and drawing or loading is done, it is possible to change the brush to a custom brush by selectng the object and using the object's property dialog and related properties displayed by setting the DialogCustomBrushVisible property to True.
Note: If you want to mix custom brush and solid brush, please set CustomBrushEnabled property to True and set the solid brush with BrushKind property.
The specifications of the custom brush function are as follows.
- The objects that can use the custom brush are Rectangle, RoundRectangle, Ellipse, Text, Stamp, Polygon, and Pen (when ClosePenLine = True) objects for which the Fill property is valid.
- The fill pattern is determined by the brushes set in the BrushKind property and the other property settings required for each brush.
-
- For a solid brush, set the BrushKind property to a value of type System.Drawing.SolidBrush and set the BackColor property.
- For a hatch brush, set the BrushKind property to a value of type System.Drawing.Drawing2D.HatchBrush and set the HatchStyle, CustomBrushColor1, and CustomBrushColor2 properties.
- For a 2 color linear gradient brush, set the BrushKind property to a value of type System.Drawing.Drawing2D.LinearGradientBrush and set the CustomBrushColor1, CustomBrushColor2, and LinearGradientMode properties.
- For a radial gradient brush, set the BrushKind property to a value of type System.Drawing.Drawing2D.RadialGradientBrush and set the CustomBrushColor1 and CustomBrushColor2 properties
- For a texture brush, set the BrushKind property to a value of type
System.Drawing.TextureBrush and set the CustomBrushImageFileName
property.
Note: If each setting is not correct, it will not cause an error but there will be a solid fill using the System.Drawing.SolidBrush and BackColor property value.
- It is not possible to set individual elements of HatchBrush such as line thickness, spacing, angle and pattern. (Only the default pattern of the System.Drawing.Drawing2D.HatchStyle enumeration are possible). In addition, changing the display scale of an ImageKit control or moving or resizing an object filled with a hatch pattern will not change the size of the hatch pattern (spacing of lines, etc.) or its position relative to the ImageKit control.
- Rotating an object (except polygons and closed pen objects)
also rotates the hatch pattern to match the angle of the
object.
Setting Value Drawing example: Horizontal / Rotated BrushKind = KindOfBrush.HatchBrush
HatchStyle = HatchStyle.Cross
CustomBrushColor1 = Color.Red
CustomBrushColor2 = Color.TransparentWhen rotated, the angle of hatch pattern changes as it rotates. The is not the case with polygon and closed pen objects because they do not have an angle attribute.
Even if the size and position of the object is different
The hatch pattern size, spacing, and the position on the ImageKit control remain the same.
- The LinearGradientBrush and RadialGradientBrush fills always display a two-color gradient that matches the display range of each object and changes with the display scale of the ImageKit control and the size and position of the object. The display also changes according to the display scale of the ImageKit control and the size and position of the object. When an object (excluding polygons and closed pens) is rotated, the direction of the gradient is also rotated according to the angle of the object.
Setting Value Drawing example: Horizontal / Rotated BrushKind = KindOfBrush.LinearGradientBrush
HatchStyle = HatchStyle.Cross
CustomBrushColor1 = Color.Red
CustomBrushColor2 = Color.Blue
LinearGradientMode = LinearGradientMode.Horizontal
The gradation angle changes according to the object's angle of rotation
Changing the object's size and position
changes the gradation.
Object rotation changes the angle of the gradient. In the case of a polygonal or closed pen, the angle of the gradation pattern will not change even if you rotate it because these objects do not have an angle attribute.
- The background image of TextureBrush is set using the CustomBrushImageFileName property. This background image is displayed in actual size (tiled) from the top left corner of the ImageKit control and therefore if the object is moved are resized, the background image of the TextureBrush does not change. When the object is rotated, the angle of the background image is not changed even if it is rotated as in the case of the Polygon and Pen objects, and the background image is also rotated according to the rotation angle in the case of other objects. (This is because Polygon and Pen objects are drawn by the coordinates of each point that constitutes them, and there is no "angle".)
Setting Value Drawing example: Horizontal / Rotated BrushKind = KindOfBrush.TextureBrush
CustomBrushImageFileName = "arrow1.png"
arrow1.png
The angle of the background image changes according to the angle of rotation of the object
When the object's size and position change
the size of the background image and its position does not change.
The angle of the background image changes when the object is rotated. In the case of a polygon or closed pen, the angle of the background image will not change even if it is rotated because these objects do not have an angle attribute.
Also See
ImageKit.Edit Members | Newtone.ImageKit.Wpf.ImageKit