文件最后提交记录最后更新时间
6 年前
6 年前
9 年前
6 年前
6 年前
README

Share a command pool between ToolbarControls

This sample demonstrates what happens when multiple ToolbarControls share the same CommandPool and use the ToolbarControl in conjunction with the MapControl and control commands.
Language:              C#, VB
Subject:               Controls
Organization:          Esri, http://www.esri.com
Date:                  10/17/2019
ArcObjects SDK:        10.8
Visual Studio:         2017, 2019
.NET Target Framework: 4.5

Resources

Usage

  1. Browse to a map document to load into the MapControl.
  2. Click the ZoomIn, ZoomOut, or Pan tool (only one tool is depressed).
  3. Share the same CommandPool between both ToolbarControls (the UsageCount changes).
  4. Click the ZoomIn, ZoomOut, or Pan tool (the same tool on both ToolbarControls are depressed).

Additional information

The AddItem method is used within the Form_Load event to add four new items to ToolbarControl1 and ToolbarControl2. Three of the items that are added to ToolbarControl1 are also added to ToolbarControl2. By default, each ToolbarControl has its own CommandPool to which these items' commands are added. One instance of each command in the CommandPool of ToolbarControl1 is used by ToolbarControl1; consequently, the ICommandPool.UsageCount of each command is one. This is the same for ToolbarControl2.
 
By selecting the check box, ToolbarControl1 and ToolbarControl2 share the CommandPool of ToolbarControl1. If any command used by ToolbarControl2 is in the CommandPool, the ICommand.UsageCount of that command increments by one. If any command used by ToolbarControl2 is not in the CommandPool, the command is added to the CommandPool with an ICommandPool.UsageCount of one.

See Also

ToolbarControl Class
IToolbarControl Interface
ICommandPool Interface


Licensing

Development licensing Deployment licensing
Engine Developer Kit Engine
ArcGIS Desktop Basic
ArcGIS Desktop Standard
ArcGIS Desktop Advanced