This sample demonstrates using the SymbologyControl to display AreaPatch and LinePatch symbols that are used to update the format of a legend. The sample uses the SymbologyControl in conjunction with the PageLayoutControl, ToolbarControl, and the controls commands.
Language: C#, VB
Subject: Controls
Organization: Esri, http://www.esri.com
Date: 3/28/2017
ArcObjects SDK: 10.5
Visual Studio: 2013, 2015
.NET Target Framework: 4.5
- ArcObjects .NET API Reference online
- Sample Data Download
- What's new
- Download the ArcObjects SDK for .Net from MyEsri.com
- Open a map document.
- Add a legend to the PageLayout.
- Change the area patch and line patch style by selecting an item from the SymbologyControl.
- Delete the legend.
A new Legend MapSurround is created and added to the GraphicsContainer of the PageLayout with a name of Legend using the IPageLayoutControl.AddElement method. The IPageLayoutControl.FindElementByName method is used to find the Legend element to delete it using the IGraphicsContainer.DeleteElement method, or update its formatting.
The LoadStyleFile method is used within the Form_Load event of the SymbolForm to add the contents of the ESRI.ServerStyle into the SymbologyControl. The StyleClass property is used to set whether AreaPatch or LinePatch symbols show in the SymbologyControl. Clicking an item shown in the SymbologyControl fires the OnItemSelectedEvent. The ILegend.Format.DefaultAreaPatch is set when the IStyleGalleryItem.Item property implements IAreaPatch, and the ILegend.Format.DefaultLinePatch is set when the IStyleGalleryItem.Item property implements ILinePatch.
SymbologyControl Class
ISymbologyControl Interface
ISymbologyStyleClass Interface
Development licensing | Deployment licensing |
---|---|
Engine Developer Kit | Engine |
ArcGIS Desktop Basic | |
ArcGIS Desktop Standard | |
ArcGIS Desktop Advanced |