Change layer rendering using the SymbologyControl


Purpose
This sample demonstrates using the SymbologyControl to display marker, line, and fill symbols, which update the symbol used by the renderer of a feature layer. The sample uses the SymbologyControl in conjunction with the PageLayoutControl, TOCControl, ToolbarControl, and the controls 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. Load a map document into the PageLayoutControl.
  2. Right-click a feature layer to change its symbology.

Additional information

The ITOCControl.HitTest method is used in the OnMouseDown event of the TOCControl to determine whether the type of item clicked implements IGeoFeatureLayer. If the IFeatureClass.ShapeType returns points, lines, or polygons, the IGeoFeatureLayer.Renderer is updated with the symbol selected in the SymbologyControl.
In the Form_Load event of the SymbolForm, the LoadStyleFile method is used to add the contents of the ESRI.ServerStyle into the SymbologyControl, and the StyleClass property is used to display MarkerSymbols, LineSymbols, or FillSymbols. The ISymbologyStyleClass.AddItem method is used to add a ServerStyleGalleryItem to the SymbologyControl with its item set to the symbol currently used by IGeoFeatureLayer.Renderer.
Clicking an item displayed in the SymbologyControl passes the selected item to the OnItemSelected event, and the ISymbologyStyleClass.PreviewItem method is used to preview the item in a PictureBox.


AssemblyInfo.cs Assembly information.
LayerRendering.cs Form file.
SymbolForm.cs Form file.
Download the C# files
AssemblyInfo.vb Assembly information.
LayerRendering.vb Form file.
SymbolForm.vb Form file.
Download the VB.NET files

Download the files for all languages

See Also:

SymbologyControl class
ISymbologyControl interface
ISymbologyStyleClass interface




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