Search
DiagramBase.DrawAdjustmentHandles Event
See Also
 





Raised when item's adjustment handles must be custom-drawn.

Namespace: MindFusion.Diagramming
Assembly: MindFusion.Diagramming

 Syntax

C#  Copy Code

public event EventHandler<DrawItemEventArgs> DrawAdjustmentHandles

Visual Basic  Copy Code

Public Event DrawAdjustmentHandles As EventHandler(Of DrawItemEventArgs)

 Event Data

DrawAdjustmentHandles event handlers receive an argument of type DrawItemEventArgs. The following DrawItemEventArgs members provide information relevant to the event:

Member name

Description

Item

The DiagramItem whose adjustment handles should be drawn.

Graphics

An object implementing the IGraphics interface whose methods should be used to draw the item's handles.

 Remarks

DrawAdjustmentHandles is raised for selected items whose HandlesStyle is set to Custom.

 Example

The following example illustrates how to draw a red frame around a node as a visualization of its adjustment handles.

C#  Copy Code

void diagram_DrawAdjustmentHandles(object sender, MindFusion.Diagramming.DrawItemEventArgs e)
{
    System.Drawing.Pen pen = new System.Drawing.Pen(Color.Red, 0);

    if (e.Item is ShapeNode)
    {
        ShapeNode shapeNode = e.Item as ShapeNode;
        RectangleF r = shapeNode.Bounds;
        e.Graphics.DrawRectangle(pen, r.X, r.Y, r.Width, r.Height);
    }

    if (e.Item is DiagramLink)
    {
        DiagramLink link = e.Item as DiagramLink;
        e.Graphics.DrawLines(pen, link.ControlPoints.GetArray());
    }

    pen.Dispose();
}

Visual Basic  Copy Code

Sub diagram_DrawAdjustmentHandles(ByVal sender As Object, ByVal e As MindFusion.Diagramming.DrawItemEventArgs)

    Dim Pen As System.Drawing.Pen = New System.Drawing.Pen(Color.Red, 0)
    If TypeOf e.Item Is ShapeNode Then

        Dim shapeNode As ShapeNode = CType(e.Item, ShapeNode)
        Dim r As RectangleF = shapeNode.Bounds
        e.Graphics.DrawRectangle(Pen, r.X, r.Y, r.Width, r.Height)

    End If
    If TypeOf e.Item Is DiagramLink Then

        Dim link As DiagramLink = CType(e.Item, DiagramLink)
        e.Graphics.DrawLines(Pen, link.ControlPoints.GetArray())

    End If
    Pen.Dispose()

End Sub

 See Also