Assign symbol to graphic elements


Purpose
This sample demonstrates how to change the symbols used by the out-of-the-box Marker, Line, Freehand, Rectangle, and Polygon element tools. By default, these tools have a black symbol (and a yellow fill where appropriate). The default symbols can be changed by updating the properties of the CommandsEnvironment singleton object. This sample uses the Symbology control in conjunction with the PageLayout control, the Toolbar control, and the controls commands. The properties on the IGraphicProperties interface are used by the controls commands to manage default symbology.
 
A combo box is populated with marker, line, fill, and text symbol items. The IStyleGalleryItem.Item property is used to determine whether the item implements IMarkerSymbol, ILineSymbol, IFillSymbol, or ITextSymbol; then the MarkerSymbol, LineSymbol, FillSymbol, or TextSymbol property on the IGraphicProperties interface is set.

How to use

See How to use ArcGIS samples for help on 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. Start the sample application. The frame is loaded with the PageLayout, TOC, and Toolbar controls and a combo box populated with marker, line, fill, and text symbol items.
  2. Click Open to load a map document into the PageLayout control.
  3. Select a background, border, or shadow from the combo box. The associated symbol type is shown in the right panel.
  4. Select Marker, Line, or Polygon from the toolbar, select the symbol(s) in the right panel, and click PageLayout. The symbols are placed.


Download the files for Java
symbologybean/AssignSymbolToGraphicElements.java This sample demonstrates how to change the symbols used by the out-of-the-box Marker, Line, Freehand, Rectangle, and Polygon element tools.




Development licensing Deployment licensing
Engine Developer Kit Engine Runtime
ArcView
ArcEditor
ArcInfo