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.

  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.

If you installed the samples feature, you will find the files associated with this sample in <Your Developer Kit install location>\DeveloperKit10.4\Java\Samples\ArcObjects.

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
ArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced