Extending ArcObjects  

Creating Custom Elements

This topic is relevant for the following:
Product(s): ArcGIS Desktop: All
Version(s): 9.0, 9.1, 9.2, 9.3
Language(s): VB6, VC++
Experience level(s): Intermediate to advanced

In this section

  1. Creating a subtype of Element
  2. General design issues for a custom element

Creating a subtype of Element

You can see from the ArcMap object model diagram that the existing element coclasses are all subtypes of the Element abstract class.

Any custom element, therefore, should implement a minimum of IElement, IElementProperties, IBoundsProperties, and ITransform2D. IElementProperties2 may 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 may also want to implement IPropertySupport, as this will increase compatibility with existing graphics tools; however, it is not mandatory and cannot be implemented in VB.

Elements are clonable and persistable. They are stored in the document.

FrameElement or GraphicElement

In the object model diagram, elements are split further, with coclasses inheriting either from the GraphicElement or FrameElement abstract classes.

Your next design decision should be whether your custom element is a FrameElement or GraphicElement.

A FrameElement is an element that implements IFrameElement and forms a border around other elements or objects. Many FrameElements, such as MapFrame and TableFrame, can only appear on a page layout.

A GraphicElement draws simple graphic shapes, pictures, or text, for example, the MarkerElement, LineElement, and TextElement. The IGraphicElement interface adds the ability for an element to appear in either page layout or data view.

Some elements, such as GroupElement and BMPPictureElement, implement both IFrameElement and IGraphicElement. They can appear both as simple graphics and can also draw with a surrounding frame and can be placed in either a page layout or data view.

ArcGIS uses different kinds of elements.
Some elements can only appear in page layout view. GraphicElements can be added to a map and will account for changes in the map's coordinate system. FrameElements have a surrounding neatline.

General design issues for a custom element

Below is a brief review of some design decisions you might need to make when creating a custom element.


Back to top

See Also InfoText Element Example, Creating other types of custom elements, and Creating Cartography.