How to use
See How to use ArcGIS samples for help on compiling, setting up the debugger, and running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.
- Browse to a map document to load into the MapControl.
- Click the ZoomIn, ZoomOut, or Pan tool (only one tool is depressed).
- Share the same CommandPool between both ToolbarControls (the UsageCount changes).
- 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.
AssemblyInfo.cs | Assembly information. |
ShareCommandPool.cs | Form file. |
AssemblyInfo.vb | Assembly information. |
ShareCommandPool.vb | Form file. |
Download the files for all languages
See Also:
ToolbarControl ClassIToolbarControl Interface
ICommandPool Interface
Development licensing | Deployment licensing |
---|---|
Engine Developer Kit | Engine Runtime |
ArcView | |
ArcEditor | |
ArcInfo |