This document is archived and information here might be outdated.  Recommended version.


Creating other kinds of custom symbols (ArcObjects .NET 10.5 SDK)

Creating other kinds of custom symbols


Summary
This topic shows different approaches to creating custom symbols, including inheriting from different abstract classes and using different techniques to perform the drawing.

In this topic


Fill symbols

You can create a custom fill symbol by implementing at least the ISymbol, IFillSymbol, and the persistence and cloning interfaces. You can also implement IMapLevel, IDisplayName, and IPropertySupport if appropriate.
If using an external library to draw polygons in particular, pay attention to complex geometries, such as self-intersecting, donut, or multipart geometries. These types of geometries can result in unexpected effects when drawing, as the library (for example, Windows graphic device interface (GDI) functions) can define the structure of complex geometries in a different way than used by ArcGIS geometries.

Text symbols

It is difficult to place text accurately, and you're not expected to create custom TextSymbols. If you need to implement ITextSymbol, your text should render correctly, not just with the basic appearance, but when drawing splined text, and text with different alignment, spacing, and so on. The display of right-to-left text should also be considered.
The ITextSymbol interface is the primary interface for defining the characteristics of text. It is inherited by the ISimpleTextSymbol and IFormattedTextSymbol interfaces and, therefore, may not need to be declared specifically. It contains the Font property, which is the first step to defining a new TextSymbol.
To set a font, first create a default font display object. Using the IFontDisp interface of your font, set the name of the font. Then set the italic, bold, strike-through, or underline parameters of IFontDisp as well as its CharacterSet and weight. In C#, you can use the StdFont object, which provides the C# standard implementation of the font object.

Chart symbols

A custom ChartSymbol can be created and applied to an existing ChartRenderer by implementing ISymbol, IChartSymbol, IMarkerSymbol, and ISymbolArray; and optionally, I3DChartSymbol, IMarkerBackgroundSupport, and IPropertySupport.
The integration, which can be achieved with an existing ChartRenderer object and its user interface (UI) components, is not as high as can be achieved by other custom symbols. The ChartRenderer and its associated UI are tightly integrated with the existing classes of ChartSymbol. The list of available ChartSymbols is predefined and is not found in a component category. A custom ChartSymbol can be applied to an existing ChartRenderer programmatically and set up as required. However, if the layer symbology is edited, the setup is not reproducible or editable in the UI.
You can improve the integration of the existing UI and your symbol by implementing one of the existing ChartSymbol interfaces: IBarChartSymbol, IPieChartSymbol, or IStackedChartSymbol. In this way, you can "piggyback" on the existing UI. Once set to a chart renderer, the existing UI can be used to alter the properties of your custom ChartSymbol via these existing interfaces. (Implement the one that has the properties closest to your requirements.) The UI may not behave as expected, since you are not providing the exact symbol expected by the renderer.
Alternatively, you can create a custom renderer designed to apply your custom ChartSymbol. Sometimes it helps to contain an instance of an existing ChartRenderer to provide a framework for the new renderer. The disadvantage of this approach is the extra work required, particularly in providing the necessary UI that allows users to set up the renderer and in the renderer drawing code.


See Also:

Creating custom symbols




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