Creating custom elements (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > Developing with ArcGIS > Learning ArcObjects > Extending ArcObjects > Mapping and visualization customizations > Creating custom elements (ArcObjects .NET 10.6 SDK)

Creating custom elements


Summary
At times, you may want to create a custom graphic element; for example, to combine graphics and text, or draw a geometry that is unsupported (such as a triangle). This topic outlines how to create a custom element.

In this topic


Creating a subtype of element

The following object model diagram (OMD) illustrates that the element coclasses are subtypes of the Element abstract class. Any custom element should implement, at a minimum, the following interfaces:
The IElementProperties2 interface can also be implemented for completeness, although this is not essential for an element to function.
In addition, elements should always implement IClone and either IPersist and IPersistStream or IPersistVariant depending on your development environment. You can also implement IPropertySupport, as this will increase compatibility with existing graphics tools; however, it is not mandatory.
Elements can be cloned and persisted and are stored in the document.

FrameElement or GraphicElement

In the following OMD, elements are split farther, with coclasses inheriting from the GraphicElement or FrameElement abstract classes. Your next design decision is whether your custom element is a FrameElement or a GraphicElement.
  • A FrameElement implements IFrameElement and forms a border around other elements or objects. Many FrameElements, such as MapFrame and TableFrame, only appear on a page layout.
  • A GraphicElement draws simple graphic shapes, pictures, or text; for example, MarkerElement, LineElement, and TextElement. The IGraphicElement interface adds the ability for an element to appear on a page layout or in data view.
Some elements, such as GroupElement and BMPPictureElement, implement both IFrameElement and IGraphicElement. They can appear as simple graphics that are drawn with a surrounding frame and placed on a page layout or in data view.
ArcGIS uses different kinds of elements. Some elements only appear in page layout view. GraphicElements can be added to a map and account for changes in the map's coordinate system. FrameElements have a surrounding neatline.

General design issues for a custom element

The following is a brief review of design decisions you may need to make when creating a custom element:
  • Does the element need to appear in the data view? If so, create a subtype of GraphicElement. Does the element need a neatline to surround it? If so, create a subtype of FrameElement.
  • Do you need access to the current map for the element to draw or behave correctly? If so, consider using VC++ and create a subtype of MapSurround instead.
  • If you decide your graphic element needs access to the current document, make sure your element can degrade its behavior safely if instantiated in a process outside ArcMap; for example, the MapControl or PageLayoutControl.
  • When deciding which existing element interfaces to implement in addition to the functionality you want to add, consider which existing property pages apply to your element.


See Also:

Creating different kinds of custom elements
Samples:




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