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.
- 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.
Additional information
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.
AssemblyInfo.cs | Assembly information. |
AreaLinePatches.cs | Form file. |
SymbolForm.cs | Form file. |
AssemblyInfo.vb | Assembly information. |
AreaLinePatches.vb | Form file. |
SymbolForm.vb | Form file. |
Download the files for all languages
See Also:
SymbologyControl ClassISymbologyControl Interface
ISymbologyStyleClass Interface
Development licensing | Deployment licensing |
---|---|
Engine Developer Kit | Engine |
ArcGIS for Desktop Basic | |
ArcGIS for Desktop Standard | |
ArcGIS for Desktop Advanced |