Invoked when a user presses the left mouse button inside the diagram drawing area.
Namespace: MindFusion.Diagramming.Wpf.Behaviors
Assembly: MindFusion.Diagramming.Wpf
C# Copy Code |
---|
public abstract InteractionState StartDraw ( |
Visual Basic Copy Code |
---|
Public MustOverride Function StartDraw( _ |
An instance of the InteractionState class, which specifies whether dragging the mouse should create or modify an item.
To start creating an item, pass a new instance of a DiagramItem derived class to the InteractionState constructor and set the constructor's action argument to Action.Create. Do not use methods such as Nodes.Add or CreateShapeNode to add the new item to the diagram; the item will be added automatically when the user completes drawing it. If creating a link, use the DiagramLink constructor that takes a single DiagramNode argument, specifying the origin node.
To start modifying an item, provide a reference to an existing item as argument of the InteractionState constructor and set the action argument to Action.Modify.
This StartDraw implementation allows only moving existing nodes or creating new nodes using the mouse:
C# Copy Code |
---|
public override InteractionState StartDraw(Point point) { DiagramNode node = Diagram.GetNodeAt(point, true, false); if (node != null) return new InteractionState(node, NodeAdjustmentHandle.Move, Action.Modify); else return new InteractionState(new ShapeNode(Diagram), null, Action.Create); } |
Visual Basic Copy Code |
---|
Public Overrides Function StartDraw(ByVal point As Point) As InteractionState Dim node As DiagramNode = Diagram.GetNodeAt(point, True, False) If Not node Is Nothing Then End Function |