Hi,
You can start from the following example:
C# Examples - Drawing View - Controller
This example demonstrates how to create a custom tool and activate it. The custom tool in the example implements a zoom to range feature, but outlines what needs to be done to make a custom tool that interacts with the document/view in a custom way.
Then you can take a look at the following example:
C# Examples - Visual Interface Components - Command Bars
The example demonstrates how to create a custom diagram command and place it in the commands bars manager. In general the creation of a toolbar command that activates a custom tool is very easy. You need to derive from NDiagramCheckButtonCommand, and override the Enabled, Checked and Executed methods of the base class. For example following is the implementation of the NEnablePanToolCommand:
public class NEnablePanToolCommand : NDiagramCheckButtonCommand
{
public NEnablePanToolCommand()
: base((int)DiagramCommandRange.Tools, (int)DiagramCommand.EnablePanTool, "Pan tool", "Pan tool")
{
}
///
/// Overriden to determine whether there is a valid commander and view
/// public override bool Enabled
{
get
{
if (Commander == null || Commander.View == null)
return false;
return true;
}
}
///
/// Determines whether the Pan tool is enabled
/// public override bool Checked
{
get
{
if (Commander == null)
return false;
NDrawingView view = Commander.m_View;
if (view == null)
return false;
return view.Controller.Tools.IsToolEnabled(NDWFR.ToolPan);
}
}
///
/// Enables the Pan tool
/// public override void Execute()
{
if (Commander == null)
return;
NDrawingView view = Commander.View;
if (view == null)
return;
view.Controller.Tools.SingleEnableTool(NDWFR.ToolPan);
}
}
Hope this helps - questions or comments - please feel free...
Best Regards,
Nevron Support Team