Raised when a hosted control must be printed, drawn in a print-preview or Overview window, or drawn in an exported bitmap.
Namespace: MindFusion.Diagramming.WinForms
Assembly: MindFusion.Diagramming.WinForms
C# Copy Code |
---|
public event EventHandler<PaintControlEventArgs> PaintControl |
Visual Basic Copy Code |
---|
Public Event PaintControl As EventHandler(Of PaintControlEventArgs) |
PaintControl event handlers receive an argument of type PaintControlEventArgs. The following PaintControlEventArgs members provide information relevant to the event:
Member name | Description |
---|---|
Node | The ControlNode whose hosted control should be custom-drawn. |
PaintRect | The bounding rectangle of the hosted control. |
Handled | Set this flag to true if you have custom-drawn the control. |
Graphics | An object implementing the IGraphics interface whose methods should be used to draw the control. |
This event is raised when a control hosted inside a ControlNode must be painted off screen. When MindFusion.Diagramming displays a diagram on the screen, hosted controls have their own windows in which they paint themselves. However, when printing diagrams, exporting them to image files or displaying them in overview or print preview windows, hosted controls cannot be always painted by MindFusion.Diagramming.
By handling PaintControl, your application can provide own rendering of the control's data. That is done by painting in the rectangle specified in PaintRect argument by means of the methods of the Graphics argument.
If that event is not handled, MindFusion.Diagramming invokes the OnPaint method of the hosted System.Windows.Forms.Control instance. However, not all controls do their painting in OnPaint; for example, some are mere wrappers of Windows common controls and their OnPaint implementation is empty.
The following example shows how to handle the event for hosted TextBox controls:
C# Copy Code |
---|
void diagramView_PaintControl(object sender, PaintControlEventArgs e) |
Visual Basic Copy Code |
---|
Private Sub diagramView_PaintControl(ByVal sender As Object, ByVal e As PaintControlEventArgs) Handles diagramView.PaintControl |