The InfoTextElement example shows you one way to create a custom element. If you are using this example as a template to create a different kind of element, you may find it useful to consider the other element interfaces discussed below.
1D and 2D elements do not generally need to account for AutoTransformation in their ITransform2D methods as it is the shape (Geometry) of the element that is transformed here.
Implementing the appropriate symbol interface (IMarkerElement, ILineElement, or IFillShapeElement) will improve integration with ArcGIS and also automatically display the appropriate Symbol property page to allow users to change the appearance of the element.
To implement a custom TextElement, you must aggregate the existing TextElement coclass. This requirement restricts the development environments that you can usesee the discussion of aggregation in the TreeFeature Custom Feature topic in Chapter 7, Customizing the Geodatabase.
If implementing ITextElement, the Text property should hold the element's text string and set this string into the element's TextSymbol. In ScaleText, you will need a reference to the view of which the element is a memberyou could do this by creating a custom tool to create your element that finds the FocusMap and passes it into your element via a custom interface. If ScaleText is True, increase or decrease the size of the element's Font so that the text's size onscreen remains constant. You also need to account for the reference scale, if one is set.
If you need to add a neatline around an element, you can implement IFrameElement in either VB or VC++. The Frame of a frame element generally surrounds another object (IFrameElement::Object) such as a map or legend, which knows how to draw itself.
FrameElements should also implement IFrameDraw and IFrameProperties. The IFrameDraw interface contains methods that will be called to draw the parts of the element separately. First, the background (IFrameElement::DrawBackground) is drawn. Next, if IFrameElement::DraftMode is True, DrawDraftMode will be calledin this method you should add simple text giving the name of the element; if DraftMode is False, IElement::Draw will be called, at which point you should draw the contained Object over its background. Last, DrawForeground will be called at which point you should draw the Frame itself.
By implementing IFrameProperties, the Frame property page will apply to your element. If you create a property page that can be successfully applied to all frame elements, you should register the page to the ESRI Frame Element Property Pages component category, instead of ESRI Element Property Pages. For example, existing frame element property pages provide a user interface for setting the Background and Border of IFrameElement. Otherwise, register the page to the ESRI Element Property Pages category.
See Also InfoText Element Example, Creating Custom Elements, and Creating Cartography.