GoDigram for .NET Framework and .NET Core
Northwoods.Go Namespace / GoView Class / ReplaceMouseTool Method
the Type of the tool to be replaced; this should not be a base class of the actual tool instance type
the tool to use instead of the existing one of Type tooltype; if null, the old tool is only removed
In This Topic
    ReplaceMouseTool Method
    In This Topic
    Replace one of the "mode-less" tools used by this view.
    Syntax
    public virtual IGoTool ReplaceMouseTool( 
       Type tooltype,
       IGoTool newtool
    )

    Parameters

    tooltype
    the Type of the tool to be replaced; this should not be a base class of the actual tool instance type
    newtool
    the tool to use instead of the existing one of Type tooltype; if null, the old tool is only removed

    Return Value

    the tool that was replaced, or null if no such instance was found
    Remarks
    When you want to customize an existing "mode-less" tool, and when setting one of its properties is insufficient, you may need to define your own subclass of that tool or define your own tool inheriting from GoTool. In order for the view to use your tool, you'll need to create an instance of your tool class for the view, and then you can either set Tool explicitly, or let GoToolManager find your tool in one of the mouse tool lists, such as MouseDownTools. For the latter case, you could just add an instance of your tool to one of those lists. But often you will not want to allow the instance of the original tool class to be used. This method makes it easy to replace an existing tool with a different one. This method searches all of the lists of mode-less tools: , , .
    Example
    You have defined a new subclass of GoToolLinkingNew, called CustomLinkTool. For each view that you want to use of this new tool instead of the standard way for users to draw new links, call aView.ReplaceMouseTool(typeof(GoToolLinkingNew), new CustomLinkTool(aView))
    See Also