WinForms

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class Tool - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class Tool

    This tool is used to implement the actions to specify user interactions like move, resize, rotate, and more for an object in the Diagram control.

    Inheritance
    System.Object
    Tool
    HandleMoveTool
    LineSegmentTool
    MoveTool
    PinPointMoveTool
    ResizeTool
    RotateTool
    UITool
    VertexMoveTool
    Implements
    System.IDisposable
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.Windows.Forms.Diagram
    Assembly: Syncfusion.Diagram.Windows.dll
    Syntax
    public abstract class Tool : IDisposable
    Remarks

    A tool is an object that receives input from a controller and implements a piece of functionality or feature. Tools are helper objects that plug into a controller. Tools are attached to a controller using the RegisterTool(Tool) method. Each tool has a Name which must be unique within a controller. The GetTool(String) method in the controller can be used to look up a tool by name.

    Activation and deactivation of tools is coordinated by the controller.

    Controller View

    Constructors

    Tool(DiagramController, String)

    Initializes a new instance of the Tool class.

    Declaration
    public Tool(DiagramController controller, string name)
    Parameters
    Type Name Description
    DiagramController controller

    The controller.

    System.String name

    The name.

    Fields

    m_ConnectorSourceEventArgs

    Declaration
    protected EndPointChangingEventArgs m_ConnectorSourceEventArgs
    Field Value
    Type Description
    EndPointChangingEventArgs

    m_ConnectorTargetEventArgs

    Declaration
    protected EndPointChangingEventArgs m_ConnectorTargetEventArgs
    Field Value
    Type Description
    EndPointChangingEventArgs

    m_ptStartOrigin

    Start origin position to calc origin offset.

    Declaration
    protected PointF m_ptStartOrigin
    Field Value
    Type Description
    System.Drawing.PointF

    m_rulerDisplayRect

    Store rectangle to display on rulers.

    Declaration
    protected Rectangle m_rulerDisplayRect
    Field Value
    Type Description
    System.Drawing.Rectangle

    m_toolPreceding

    Preceding tool.

    Declaration
    protected Tool m_toolPreceding
    Field Value
    Type Description
    Tool

    Properties

    ActionCursor

    Gets or setsTool Action cursor.

    Declaration
    public Cursor ActionCursor { get; set; }
    Property Value
    Type Description
    System.Windows.Forms.Cursor

    CanRender

    Gets or sets a value indicating whether this instance can render.

    Declaration
    protected bool CanRender { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if this instance can render; otherwise, false.

    Controller

    Gets the Tool Controller.

    Declaration
    public DiagramController Controller { get; }
    Property Value
    Type Description
    DiagramController

    CurrentCursor

    Gets or sets helper property holding current cursor.

    Declaration
    protected Cursor CurrentCursor { get; set; }
    Property Value
    Type Description
    System.Windows.Forms.Cursor

    CurrentPoint

    Gets or sets the current point in client coordinates.

    Declaration
    protected Point CurrentPoint { get; set; }
    Property Value
    Type Description
    System.Drawing.Point

    The current point.

    CurrentToolCursor

    Gets the property is used by controller to update current viewer cursor.

    Declaration
    public Cursor CurrentToolCursor { get; }
    Property Value
    Type Description
    System.Windows.Forms.Cursor

    InAction

    Gets or sets a value that indicates whether to find the activated tool is currently in progress mode.

    Declaration
    public bool InAction { get; set; }
    Property Value
    Type Description
    System.Boolean

    Name

    Gets or sets to specify a name for the tool that is currently activated/ deactivated in the Diagram control.

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    System.String

    The name.

    PrecedingTool

    Gets the previously activated tool, which is used to activate the previously activated tool if the current tool action has been completed.

    Declaration
    public Tool PrecedingTool { get; }
    Property Value
    Type Description
    Tool

    The preceding tool.

    RulerHeight

    Gets the height of the ruler.

    Declaration
    protected int RulerHeight { get; }
    Property Value
    Type Description
    System.Int32

    The height of the ruler.

    SingleActionTool

    Gets or sets a value indicating whether tool lifetime should be single action. SingleActionTool restores preceding tool after performing its action.

    Declaration
    public bool SingleActionTool { get; set; }
    Property Value
    Type Description
    System.Boolean

    StartPoint

    Gets or sets Tool Action start point in client coordinates.

    Declaration
    protected Point StartPoint { get; set; }
    Property Value
    Type Description
    System.Drawing.Point

    ToolCursor

    Gets or sets Tool Cursor

    Declaration
    public Cursor ToolCursor { get; set; }
    Property Value
    Type Description
    System.Windows.Forms.Cursor

    ToolWorkRect

    Gets current work refresh rectangle.

    Declaration
    public Rectangle ToolWorkRect { get; }
    Property Value
    Type Description
    System.Drawing.Rectangle
    Remarks

    Used primarily by controller for updating viewer.

    WorkRect

    Gets or sets the work refresh rectangle.

    Declaration
    public Rectangle WorkRect { get; set; }
    Property Value
    Type Description
    System.Drawing.Rectangle

    The work rectangle.

    WorkRectPrev

    Gets or sets the previous work refresh rectangle.

    Declaration
    protected Rectangle WorkRectPrev { get; set; }
    Property Value
    Type Description
    System.Drawing.Rectangle

    The previous work rectangle.

    Methods

    Abort()

    Aborts tool actions.

    Declaration
    public virtual Tool Abort()
    Returns
    Type Description
    Tool

    The tool to abort.

    ActivateTool()

    Activates the tool.

    Declaration
    public virtual void ActivateTool()

    AppendParentTransformations(PointF, Node)

    Get point without parent transformations.

    Declaration
    protected PointF AppendParentTransformations(PointF ptCur, Node node)
    Parameters
    Type Name Description
    System.Drawing.PointF ptCur

    The given point.

    Node node

    The node.

    Returns
    Type Description
    System.Drawing.PointF

    The transformation points.

    ApplyDecorator(Decorator, Decorator)

    Applies the decorator to node.

    Declaration
    protected void ApplyDecorator(Decorator decorTool, Decorator decorNode)
    Parameters
    Type Name Description
    Decorator decorTool

    The decorator tool.

    Decorator decorNode

    The decorator node.

    CanAddNode(Rectangle)

    Check if node can be added to diagram.

    Declaration
    protected bool CanAddNode(Rectangle rectBounding)
    Parameters
    Type Name Description
    System.Drawing.Rectangle rectBounding
    Returns
    Type Description
    System.Boolean

    true, if can add node.

    CanInsert(Node)

    Checks whether node could be inserted into document.

    Declaration
    protected bool CanInsert(Node nodeToInsert)
    Parameters
    Type Name Description
    Node nodeToInsert

    Node to insert

    Returns
    Type Description
    System.Boolean

    true, if can insert.

    CheckBoundaryConstraints(Node, Matrix)

    Check if node is contained in model.

    Declaration
    protected bool CheckBoundaryConstraints(Node node, Matrix mtxParentTransformations)
    Parameters
    Type Name Description
    Node node

    Node to check.

    System.Drawing.Drawing2D.Matrix mtxParentTransformations

    The matrix of parent transformations.

    Returns
    Type Description
    System.Boolean

    true, if node inside model

    CheckConnectionCenterPort(PointF)

    Checks the for possibility connect to center port.

    Declaration
    protected ConnectionPoint CheckConnectionCenterPort(PointF ptPoint)
    Parameters
    Type Name Description
    System.Drawing.PointF ptPoint

    The point.

    Returns
    Type Description
    ConnectionPoint

    The connection point

    CheckConnectionPossibility(PointF)

    Checks for connection possibility.

    Declaration
    protected ConnectionPoint CheckConnectionPossibility(PointF ptTest)
    Parameters
    Type Name Description
    System.Drawing.PointF ptTest

    The point.

    Returns
    Type Description
    ConnectionPoint

    The connection point

    DeactivateTool()

    Deactivates the tool.

    Declaration
    public virtual void DeactivateTool()

    Dispose()

    Declaration
    public virtual void Dispose()

    Draw(Graphics)

    Draws the specified graphics.

    Declaration
    public virtual void Draw(Graphics gfx)
    Parameters
    Type Name Description
    System.Drawing.Graphics gfx

    Graphics to draw on.

    DrawFrameAroundPort(Graphics, ConnectionPoint)

    Draws the frame around port.

    Declaration
    protected virtual void DrawFrameAroundPort(Graphics gfx, ConnectionPoint port)
    Parameters
    Type Name Description
    System.Drawing.Graphics gfx

    Graphics to draw on.

    ConnectionPoint port

    The port.

    DrawRenderHelper(Node, Graphics)

    Draws render helper

    Declaration
    protected virtual void DrawRenderHelper(Node renderHelper, Graphics gfx)
    Parameters
    Type Name Description
    Node renderHelper

    The render helper.

    System.Drawing.Graphics gfx

    Graphics to draw on.

    DrawRenderHelper(Node, Graphics, Rectangle)

    Draws render helper

    Declaration
    protected void DrawRenderHelper(Node renderHelper, Graphics gfx, Rectangle bounds)
    Parameters
    Type Name Description
    Node renderHelper

    The render helper.

    System.Drawing.Graphics gfx

    Graphics to draw on.

    System.Drawing.Rectangle bounds

    The bounds of render helper.

    GetCurrentPoint(Boolean)

    Get current mouse position in client coordinates with origin offset.

    Declaration
    protected Point GetCurrentPoint(bool bSnapToGrid)
    Parameters
    Type Name Description
    System.Boolean bSnapToGrid

    if set to true point will snap to grid before return.

    Returns
    Type Description
    System.Drawing.Point

    Current mouse position in client coordinates.

    GetEndPointLocation(ConnectionPoint, PointF)

    Gets the end point location.

    Declaration
    protected PointF GetEndPointLocation(ConnectionPoint port, PointF ptLocation)
    Parameters
    Type Name Description
    ConnectionPoint port

    The port.

    System.Drawing.PointF ptLocation

    The location.

    Returns
    Type Description
    System.Drawing.PointF

    The end point location.

    GetFrameRectangle(Boolean)

    Get rectangle created from start and current point with append origin offset.

    Declaration
    protected RectangleF GetFrameRectangle(bool bSnapToGrid)
    Parameters
    Type Name Description
    System.Boolean bSnapToGrid

    if set to true start and current point will snap before generate frame rectangle.

    Returns
    Type Description
    System.Drawing.RectangleF

    The frame rect

    GetFullRotationAngle(Node)

    Gets the rotation angle.

    Declaration
    protected float GetFullRotationAngle(Node node)
    Parameters
    Type Name Description
    Node node

    The node.

    Returns
    Type Description
    System.Single

    The rotation angle.

    GetInsideNodeAt(PointF)

    Get the inside node composite node.

    Declaration
    protected Node GetInsideNodeAt(PointF ptLocation)
    Parameters
    Type Name Description
    System.Drawing.PointF ptLocation

    The point to check.

    Returns
    Type Description
    Node

    Node inside composite node what contain given point.

    GetLocalPoint(Node, PointF)

    Gets the local point without node parents transformations.

    Declaration
    protected PointF GetLocalPoint(Node parent, PointF ptLocation)
    Parameters
    Type Name Description
    Node parent

    The parent.

    System.Drawing.PointF ptLocation

    The given point.

    Returns
    Type Description
    System.Drawing.PointF

    The local point.

    GetNodeUnderEndPoint(PointF)

    Gets the node under end point.

    Declaration
    protected Node GetNodeUnderEndPoint(PointF endPointLocation)
    Parameters
    Type Name Description
    System.Drawing.PointF endPointLocation

    The end point container.

    Returns
    Type Description
    Node

    The node under end point.

    GetOriginOffset()

    Get the origin offset from mouse down in model coordinates.

    Declaration
    protected SizeF GetOriginOffset()
    Returns
    Type Description
    System.Drawing.SizeF

    Origin offset.

    GetPointOffset(PointF, Node)

    Gets the point offset.

    Declaration
    protected SizeF GetPointOffset(PointF ptPoint, Node node)
    Parameters
    Type Name Description
    System.Drawing.PointF ptPoint

    The pt point.

    Node node

    The node.

    Returns
    Type Description
    System.Drawing.SizeF

    The point offset.

    GetPortBounds(ConnectionPoint, Single)

    Get the port bounds.

    Declaration
    protected RectangleF GetPortBounds(ConnectionPoint port, float fZoomFactor)
    Parameters
    Type Name Description
    ConnectionPoint port

    The port.

    System.Single fZoomFactor

    Graphics zoom factor.

    Returns
    Type Description
    System.Drawing.RectangleF

    Bounds of given port.

    GetSelectionList()

    Get selection list using model EnableSelectionListSubstitute property value.

    Declaration
    public NodeCollection GetSelectionList()
    Returns
    Type Description
    NodeCollection

    Selection list.

    GetSnapCurrentPoint()

    Get snap current mouse position in client coordinates with origin offset.

    Declaration
    protected PointF GetSnapCurrentPoint()
    Returns
    Type Description
    System.Drawing.PointF

    Current mouse position in client coordinates.

    GetSnapStartPoint()

    Get snap start mouse position in client coordinates with append origin offset.

    Declaration
    protected PointF GetSnapStartPoint()
    Returns
    Type Description
    System.Drawing.PointF

    Start mouse position in client coordinates with origin offset.

    GetStartPoint(Boolean)

    Get start mouse position in client coordinates with append origin offset.

    Declaration
    protected Point GetStartPoint(bool bSnapToGrid)
    Parameters
    Type Name Description
    System.Boolean bSnapToGrid

    if set to true point will snap to grid before return.

    Returns
    Type Description
    System.Drawing.Point

    Start mouse position in client coordinates with origin offset.

    HighlightCenterPortContainer(Graphics, ConnectionPoint)

    Highlights the center port container.

    Declaration
    protected void HighlightCenterPortContainer(Graphics gfx, ConnectionPoint port)
    Parameters
    Type Name Description
    System.Drawing.Graphics gfx

    Graphics to draw on.

    ConnectionPoint port

    The end point.

    MakeControlNodeSnapshot(ControlNode)

    Make the control node snapshot.

    Declaration
    protected Image MakeControlNodeSnapshot(ControlNode nodeCtrl)
    Parameters
    Type Name Description
    ControlNode nodeCtrl

    The control node .

    Returns
    Type Description
    System.Drawing.Image

    Snapshot of given control node.

    OnConnectorChanging(EndPointChangingEventArgs)

    Declaration
    protected virtual void OnConnectorChanging(EndPointChangingEventArgs evtArgs)
    Parameters
    Type Name Description
    EndPointChangingEventArgs evtArgs

    OnOriginChanged(ViewOriginEventArgs)

    Raise the origin changed event.

    Declaration
    protected virtual void OnOriginChanged(ViewOriginEventArgs evtArgs)
    Parameters
    Type Name Description
    ViewOriginEventArgs evtArgs

    The ViewOriginEventArgs instance containing the event data.

    OutlineConnectionPoint(Graphics, ConnectionPoint)

    Outlines possible connection point.

    Declaration
    protected void OutlineConnectionPoint(Graphics gfx, ConnectionPoint port)
    Parameters
    Type Name Description
    System.Drawing.Graphics gfx

    Graphics to draw on.

    ConnectionPoint port

    ConnectionPoint to outline.

    ProcessClick()

    Processes the click.

    Declaration
    public virtual Tool ProcessClick()
    Returns
    Type Description
    Tool

    The tool.

    ProcessDoubleClick(MouseEventArgs)

    Processes the double click.

    Declaration
    public virtual Tool ProcessDoubleClick(MouseEventArgs evtArgs)
    Parameters
    Type Name Description
    System.Windows.Forms.MouseEventArgs evtArgs

    The System.Windows.Forms.MouseEventArgs instance containing the event data.

    Returns
    Type Description
    Tool

    The tool.

    ProcessKeyDown(KeyEventArgs)

    Processes the key down.

    Declaration
    public virtual Tool ProcessKeyDown(KeyEventArgs evtArgs)
    Parameters
    Type Name Description
    System.Windows.Forms.KeyEventArgs evtArgs

    The System.Windows.Forms.KeyEventArgs instance containing the event data.

    Returns
    Type Description
    Tool

    The tool.

    ProcessKeyPress(KeyPressEventArgs)

    Processes the key press.

    Declaration
    public virtual Tool ProcessKeyPress(KeyPressEventArgs evtArgs)
    Parameters
    Type Name Description
    System.Windows.Forms.KeyPressEventArgs evtArgs

    The System.Windows.Forms.KeyPressEventArgs instance containing the event data.

    Returns
    Type Description
    Tool

    The tool.

    ProcessKeyUp(KeyEventArgs)

    Processes the key up.

    Declaration
    public virtual Tool ProcessKeyUp(KeyEventArgs evtArgs)
    Parameters
    Type Name Description
    System.Windows.Forms.KeyEventArgs evtArgs

    The System.Windows.Forms.KeyEventArgs instance containing the event data.

    Returns
    Type Description
    Tool

    The tool.

    ProcessMouseDown(MouseEventArgs)

    Processes the mouse down.

    Declaration
    public virtual Tool ProcessMouseDown(MouseEventArgs evtArgs)
    Parameters
    Type Name Description
    System.Windows.Forms.MouseEventArgs evtArgs

    The System.Windows.Forms.MouseEventArgs instance containing the event data.

    Returns
    Type Description
    Tool

    The tool.

    ProcessMouseMove(MouseEventArgs)

    Processes the mouse move.

    Declaration
    public virtual Tool ProcessMouseMove(MouseEventArgs evtArgs)
    Parameters
    Type Name Description
    System.Windows.Forms.MouseEventArgs evtArgs

    The System.Windows.Forms.MouseEventArgs instance containing the event data.

    Returns
    Type Description
    Tool

    The tool.

    ProcessMouseUp(MouseEventArgs)

    Processes the mouse up.

    Declaration
    public virtual Tool ProcessMouseUp(MouseEventArgs evtArgs)
    Parameters
    Type Name Description
    System.Windows.Forms.MouseEventArgs evtArgs

    The System.Windows.Forms.MouseEventArgs instance containing the event data.

    Returns
    Type Description
    Tool

    The tool.

    QuiteBoundarySet(Boolean)

    Quites set boundary value without record in history and calling sink events.

    Declaration
    protected void QuiteBoundarySet(bool bBoundaryConstraintsEnabled)
    Parameters
    Type Name Description
    System.Boolean bBoundaryConstraintsEnabled

    if set to true boundary constraints enabled.

    QuiteBridgingSet(Boolean)

    Quites set line bridging flag without record in history and calling sink events.

    Declaration
    protected void QuiteBridgingSet(bool bLineBridgingEnabled)
    Parameters
    Type Name Description
    System.Boolean bLineBridgingEnabled

    if set to true line bridging enabled.

    SmartSnap(PointF, SizeF)

    Snaps and updates snapped point.

    Declaration
    protected PointF SmartSnap(PointF ptSnapping, SizeF szOffset)
    Parameters
    Type Name Description
    System.Drawing.PointF ptSnapping

    snapping point

    System.Drawing.SizeF szOffset

    moving entity bounding rectangle left-top point offset

    Returns
    Type Description
    System.Drawing.PointF

    snapped point

    SnapToPort(PointF, SizeF)

    Snaps to port.

    Declaration
    protected PointF SnapToPort(PointF ptPoint, SizeF szOffset)
    Parameters
    Type Name Description
    System.Drawing.PointF ptPoint

    The given point in client coordinates.

    System.Drawing.SizeF szOffset

    The size offset.

    Returns
    Type Description
    System.Drawing.PointF

    The point that snapped to port.

    SnapToPort(PointF, SizeF, out Node)

    Snaps to nearest port.

    Declaration
    protected PointF SnapToPort(PointF ptPoint, SizeF szOffset, out Node nodeHit)
    Parameters
    Type Name Description
    System.Drawing.PointF ptPoint

    The snapping point in client coordinates.

    System.Drawing.SizeF szOffset

    moving entity bounding rectangle left-top point offset

    Node nodeHit

    The node hit.

    Returns
    Type Description
    System.Drawing.PointF

    Port position.

    UpdateConnnectorChangeEvent(IEndPointContainer, ConnectionPoint, ConnectionPoint)

    Declaration
    protected ConnectionPoint UpdateConnnectorChangeEvent(IEndPointContainer connector, ConnectionPoint tailPossibleConnection, ConnectionPoint headPossibleConnection)
    Parameters
    Type Name Description
    IEndPointContainer connector
    ConnectionPoint tailPossibleConnection
    ConnectionPoint headPossibleConnection
    Returns
    Type Description
    ConnectionPoint

    UpdateCursor(Boolean)

    Updates the cursor to current tool state.

    Declaration
    protected void UpdateCursor(bool bCanDo)
    Parameters
    Type Name Description
    System.Boolean bCanDo

    if set to true cursor change to current tool cursor, else to NoCursor.

    UpdatePortRefreshRect(ConnectionPoint, ref Rectangle)

    Updates the port refresh rectangle.

    Declaration
    protected void UpdatePortRefreshRect(ConnectionPoint port, ref Rectangle rectPortFrame)
    Parameters
    Type Name Description
    ConnectionPoint port

    The port.

    System.Drawing.Rectangle rectPortFrame

    The port frame.

    Implements

    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2021 Syncfusion Inc. All Rights Reserved