Search
Step 10: Add custom nodes to click events

Add custom nodes programmatically in response to click events.

C#  Copy Code

private void diagram_Clicked(object sender, DiagramEventArgs e)
{
    IconNode iconNode = new IconNode(diagram);
    diagram.Nodes.Add(iconNode);

    iconNode.Move(e.MousePosition.X, e.MousePosition.Y);
}

Visual Basic  Copy Code

Private Sub diagram_Clicked(ByVal sender As Object, ByVal e As DiagramEventArgs) Handles diagram.Clicked

    Dim iconNode As IconNode = New IconNode(diagram)
    diagram.Nodes.Add(iconNode)

    iconNode.Move(e.MousePosition.X, e.MousePosition.Y)

End Sub