Nevron .NET Vision
Diagram for .NET / User's Guide / WinForm Components / Tools

In This Topic
    Tools
    In This Topic
    Tools are replaceable controller parts, which are used to process mouse, keyboard and drag and drop events dispatched to them by the controller. The base class for all tools is the abstract NTool class.
     Common Tool Features

    NTool implements the core tool features, which each tool possesses. They are:

    • Name - each tool has a name, which can be modified from the Name property. It is important to know that the names of the tools, which reside in the NToolCollection (accessible from the Tools property of the controller) must be unique. In fact the tools collection will not let you add a tool with a duplicate name.
    • Enabled/disabled state - in order for tools to activate they need to be enabled. This is controlled by the Enabled property.
    • Ability to Activate and Deactivate or Abort - tools can operate in two states - active and inactive. When a tool is active it will receive all view mouse and keyboard events. The transition between these states is performed by the Activate and Deactivate methods. You must call the CanActivate method prior to calling the Activate method and the CanDeactivate method prior to calling the Deactivate method. The actual work performed by tools, which can activate is performed by the Deactivate method. If a tool is active you can always abort it by calling its Abort method.
     Types of Tools

    The type of the tool in general is determined by the interfaces it implements. Currently supported are the following primary types of tools:

    Drag tools are Mouse and Keyboard tools, which can be activated and support double pass activation. The base class for such tools is the NDragTool abstract class (derived from NMouseAndKeyboardTool).

    Since the controller is assigned to each NView instance, but tools need to know the actual view and document type (drawing or library), the component logically separates the tools by the instancable view type in which they can reside.

    In this way all drawing tools derive from the base NDrawingMouseAndKeyboardTool, NDrawingDragDropTool and NDrawingDragTool. Analogously library tools derive from the base NLibraryMouseAndKeyboardTool, NLibraryDragDropTool and NLibraryDragTool.

     Enabling and Disabling Tools

    As already mentioned the tool enabled/disabled state is determined by the value of its Enabled property. The NToolCollection however provides several methods, which help you enable/disable single or multiple tools by their names (that is why the name of the tool must be unique in the context of this collection).

    It is important to know that the tool collection maintains a list of the tool names, which are considered to be ambient. The ambient tools are tools, which are by default enabled and are not disabled if you use the SingleEnableTool or SingleEnableTools methods to enable a configuration of tools. For example:

    C#
    Copy Code
    // enable only the rectangle tool, but do not disable the ambient tools
    drawingView.Controller.Tools.SingleEnableTool(NDWFR.ToolCreateRectangle);
    
    Visual Basic
    Copy Code
    ' enable only the rectangle tool, but do not disable the ambient tools
    drawingView.Controller.Tools.SingleEnableTool(NDWFR.ToolCreateRectangle)
    
     Currently Available Drawing Tools

    Following is a list of the currently available drawing tools:

    Tool class Description
    General tools
    NSelectorTool Represents a tool, which is used to modify the selection
    NMoveTool Represents a tool, which is used to translate the selected elements inside the document or drag and drop them into another document. If the Control key is pressed it can also duplicate elements.
    NPanTool Represents a tool, which is used for the interactive scrolling of the view
    NHandleTool Represents a tool, which is used to drag handles
    NContextMenuTool Represents a tool, which is used to display context menus
    NInplaceEditTool Represents a tool, which is used for the inplace editing of nodes
    NKeyboardTool Represents a tool, which is used to process single key actions

    NMouseWheelScrollAndZoomTool

    Represents a tool, which performs mouse wheel scrolling and zooming. Also implements anchor scrolling.
    Create element tools
    NCreateGuidelineTool Represents a tool, which is used to create new horizontal and vertical guidelines
    NCreateBezierCurveTool Represents a tool, which is used to create new bezier curves
    NCreateEllipseTool Represents a tool, which is used to create new ellipses
    NCreateEllipticalArcTool Represents a tool, which is used to create new elliptical arcs
    NCreateLineTool Represents a tool, which is used to create new lines
    NCreateRectangleTool Represents a tool, which is used to create new rectangles
    NCreateShapeTool Represents a tool, which is used to create new shapes
    NCreateTextTool Represents a tool, which is used to create new texts
    NCreateClosedCurveTool Represents a tool, which is used to create new closed curves
    NCreateCurveTool Represents a tool, which is used to create new curves
    NCreatePolygonTool Represents a tool, which is used to create new polygons
    NCreatePolylineTool Represents a tool, which is used to create new polylines
    Event delegator tools
    NMouseEventDelegatorTool Represents a tool, which delegates mouse events to the drawing document
    NKeyboardEventDelegatorTool Represents a tool, which delegates keyboard events to the drawing document
    NDragDropEventDelegatorTool Represents a tool, which delegates drag and drop events to the drawing document
    Related to drag drop
    NDragDropTargetTool Represents a tool, which is used to extend the drawing view as a drag drop target

     Currently Available Library Tools

    Following is a list of the currently available library tools:

    Tool class Description
    General tools
    NLibrarySelectorTool Represents a tool, which is used to select masters
    NLibraryMoveTool Represents a tool, which is used to reorder selected masters inside the view, or drag and drop them into another document. If the Control key is pressed it can also duplicate masters.
    NLibraryContextMenuTool Represents a tool, which is used to display context menus
    NLibraryKeyboardTool Represents a tool, which is used to process single key actions
    NLibraryTooltipsTool Represents a tool, which displays tooltips for the library view items

    NLibraryMouseWheelScrollTool

    Represents a tool which implements mouse wheel scrolling in the context of library views. Supports anchor scrolling.
    Related to drag drop
    NLibraryDropTargetTool Represents a tool, which is used to extend the library view as a drag drop target

     Related Examples
    Windows Forms: Drawing View - Controller 
    Windows Forms: Drawing View - Events Processing, Delegation and Bubbling
    See Also