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.
- Navigate around the data using the commands on the ToolbarControl.
- Enable the extension and navigate around the data using the commands from the extension.
Additional information
The AddItem method is used within the Form Load event to add new command items to the ToolbarControl with their style set. These command items are defined in the controls commands library and the ZoomFactor extension.
The ZoomFactor extension is created via its ProgID and added to the ExtensionManager singleton object using the IExtensionManagerAdmin.AddExtension method. The application is responsible for the lifetime and state of the ZoomFactor extension. The IExtensionManager.FindExtension method is used to find the ZoomFactor extension, and the IExtensionConfig.State property controls the state of the ZoomFactor extension.
The ZoomFactor extension is used to control the state of the ZoomIn, ZoomOut, and SetZoomFactor commands. The ZoomFactor extension implements IExtension, IExtensionConfig, and the IZoomExtension custom interface, which has a ZoomFactor property. The SetZoomFactor command prompts you for a zoom factor to set into the ZoomFactor property. The ZoomIn and ZoomOut commands use the ZoomFactor to determine the zoom ratio. The Enabled state of each command is determined by IExtensionConfig.State.
Application/AssemblyInfo.cs | Assembly information. |
Application/ToolbarControlExtension.cs | Form file. |
Extension/AssemblyInfo.cs | Assembly information. |
Extension/InputForm.cs | Form file. |
Extension/IZoomExtension.cs | Class file. |
Extension/SetZoomFactor.cs | Class file. |
Extension/ZoomExtension.cs | Class file. |
Extension/ZoomIn.cs | Class file. |
Extension/ZoomOut.cs | Class file. |
Application/AssemblyInfo.vb | Assembly information. |
Application/ToolbarControlExtension.vb | Form file. |
Extension/AssemblyInfo.vb | Assembly information. |
Extension/IZoomExtension.vb | Class file. |
Extension/SetZoomFactor.vb | Class file. |
Extension/ZoomExtension.vb | Class file. |
Extension/ZoomIn.vb | Class file. |
Extension/ZoomOut.vb | Class file. |
Download the files for all languages
See Also:
ToolbarControl classIToolbarControl interface
Development licensing | Deployment licensing |
---|---|
Engine Developer Kit | Engine |
ArcGIS for Desktop Basic | |
ArcGIS for Desktop Standard | |
ArcGIS for Desktop Advanced |