Current active tool for the MapControl. Set to nothing to clear the tool.
ERROR: Syntax information about IMapControl3.CurrentTool may not be in D:\ArcGIS\DotNet\ESRI.ArcGIS.Controls.dll
[C++]
HRESULT get_CurrentTool(
ITool** pTool
);
[C++]
HRESULT putref_CurrentTool(
ITool* pTool
);
[C++]Parameters
pTool [out, retval]pTool is a parameter of type ITool
pTool [in]pTool is a parameter of type ITool
Product Availability
Description
The CurrentTool is the Tool used to interact will the MapControl's display. Always check if a tool is enabled before setting it to the CurrentTool property, otherwise a user will be able to use a tool that is actually disabled.
Errors Returned
1004 800a03ec: Current tool will not deactivate
Remarks
When the CurrentTool is set the following events occur:
- The ITool::Deactivate event is triggered on the 'old' CurrentTool if one was set. If this event returns false a trappable error ocurrs. If this event returns true the 'old' CurrentTool is removed and replaced.
- The ICommand::OnClick event is triggered on the 'new' CurrentTool and its cursor is picked up.
Within an ITool implementation it is recommended that the ITool::Deactivate event returns true. This allows a 'new' CurrentTool to be set, and allows the release of the CurrentTool when an application is shutting down.
ICommand command = new ControlsMapPanToolClass();
command.OnCreate(axMapControl1.Object);
if (command.Enabled == true)
{
axMapControl1.CurrentTool= (ITool) command;
}
Dim pCommand As ICommand
pCommand = New ControlsMapPanToolClass
pCommand.OnCreate(AxMapControl1.Object)
If pCommand.Enabled = True Then
AxMapControl1.CurrentTool = pCommand
End If