Skip to content

Latest commit

 

History

History
 
 

ControlsCommandsEnvironment

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Controls commands environment

This sample demonstrates changing the symbols used by the out-of-the-box New Marker, Line, Freehand, Rectangle, and Polygon element tools. By default, these tools use a black symbol (and a yellow fill where appropriate). The default symbols can be changed by updating the properties of the CommandsEnvironment singleton object. The sample uses the SymbologyControl in conjunction with the PageLayoutControl, ToolbarControl, and the controls commands. The properties on the IGraphicProperties interface are used by the controls commands to manage default symbology.
 
This sample has been developed on a machine with a display screen resolution of 96 dots per inch (dpi). This sample also contains code that will correctly scale the ArcGIS Engine controls when run at a resolution of 120 dpi. This issue is discussed in detail in the [Workaround for controls display issues in 96 versus 120 dpi](http://6cebc1d9-2318-472e-923a-13e13b1a8e45) topic.
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

Resources

Usage

  1. Load a map document into the PageLayoutControl.
  2. Add elements to the display using the commands on the ToolbarControl.
  3. Right-click the display to add a text element containing today's date.
  4. Change the application default symbol properties using the combo box and the items displayed in the SymbologyControl.
  5. Repeat steps 2 and 4 if desired.

Additional information

The LoadStyleFile method is used within the Form_Load event to add the contents of ESRI.ServerStyle into the SymbologyControl. A new ServerStyleGalleryItem is created with its name set to myStyle and its item set to the MarkerSymbol, LineSymbol, FillSymbol, and TextSymbol properties on the IGraphicProperties interface. ServerStyleGalleryItem is added to the appropriate StyleClass using the ISymbologyStyleClass.AddItem method.
 
A combo box is populated with marker, line, fill, and text symbol items. The SelectedIndexChanged event of the combo box is used to set the type of items displayed in the SymbologyControl using the StyleClass property. Clicking an item displayed in the SymbologyControl fires OnItemSelectedEvent. The IStyleGalleryItem.Item property is used to determine whether the item implements IMarkerSymbol, ILineSymbol, IFillSymbol, or ITextSymbol; and either the MarkerSymbol, LineSymbol, FillSymbol, or TextSymbol property on the IGraphicProperties interface is set.
 
The IPageLayoutControlEvents.OnMouseDown event is used to create a new TextElement. The Text property is set to today's date and the Symbol property is set to IGraphicsProperties.TextSymbol. The element is added to the GraphicsContainer using the IPageLayoutControl.AddElement method.

See Also

CommandsEnvironment class
IGraphicProperties interface
Workaround for controls display issues in 96 versus 120 dpi


Licensing

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