This document is archived and information here might be outdated.  Recommended version.


IPageLayoutControl.CurrentTool Property (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IP > IPageLayoutControl Interface > IPageLayoutControl.CurrentTool Property
ArcGIS Developer Help

IPageLayoutControl.CurrentTool Property

Current active tool for the PageLayoutControl. Set to nothing to clear the tool.

[Visual Basic .NET]
Public Property CurrentTool As ITool
[C#]
public ITool CurrentTool {get; set;}
[C++]
HRESULT get_CurrentTool(
void
);
[C++]
HRESULT putref_CurrentTool(
);

Product Availability

Available with ArcGIS Engine.

Description

The CurrentTool is the tool used to interact will the PageLayoutControl'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:

  1. 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.
  2. 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.

[C#]
ICommand command = new ControlsPagePanToolClass);
command.OnCreate(axPageLayoutControl1.Object);
if (command.Enabled == true)
{
  axPageLayoutControl1.CurrentTool= (ITool) command;
}
[Visual Basic .NET]
Dim pCommand As ICommand
pCommand = New ControlsPagePanToolClass
pCommand.OnCreate(AxPageLayoutControl1.Object)
If pCommand.Enabled = True Then
  AxPageLayoutControl1.CurrentTool = pCommand
End If

See Also

IPageLayoutControl Interface