Custom map selection commands


Purpose
This sample provides a set of Select commands and tools that can be used in conjunction with the MapControl, PageLayoutControl, and ToolbarControl. It is assumed you have previous experience in creating custom tools and commands.

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.

  1. Build the project.
  2. Do one of the following: a) Add the commands to the ToolbarControl programmatically using the IToolbarControl.AddItem method; b) Use the commands directly with the MapControl or PageLayoutControl programmatically by creating a new instance of a command and passing the MapControl or PageLayoutControl to its OnCreate event; c) Add the commands interactively to the ToolbarControl by clicking the Add from File button in the ToolbarControl's Customizing dialog box, (available through the property pages) and browsing to the *.tlb file; or d) Add the commands interactively to the ToolbarControl by dragging them from the Sample_Select category in the ToolbarControl's Customizing dialog box.

Additional information

This sample uses the following:
  • Select Features tool—An IRubberBand object is used to track an IEnvelope object in the OnMouseDown event. The envelope is passed to the IMap.SelectByShape method to select features in the FocusMap.
  • Clear Selected Features command—The IMap.ClearSelection method is used to clear any selected features in the FocusMap.


AssemblyInfo.cs Assembly information.
SelectFeatures.cs Class file.
ClearFeatureSelection.cs Class file.
Download the C# files
AssemblyInfo.vb Assembly information.
SelectFeatures.vb Form file.
ClearFeatureSelection.vb Class file.
Download the VB.NET files

Download the files for all languages

See Also:

HookHelper Class
IHookHelper Interface




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