TextElement with a solid background color

720
4
07-11-2011 09:48 AM
JimCampbell
New Contributor
How can I create a TextElement with a solid background color?
0 Kudos
4 Replies
JeffreyHamblin
New Contributor III
With a TextElement, the only way I know to set the background color is to set the background to a balloon callout. But this has some likely unwanted callout features.

Probably best to use ParagraphTextElement, which gives you control over background, outline, etc.

There is a sample of how to use it in the thread: Paragraph text in Pagelayout
0 Kudos
AlexanderGray
Occasional Contributor III
With a TextElement, the only way I know to set the background color is to set the background to a balloon callout. But this has some likely unwanted callout features.

Probably best to use ParagraphTextElement, which gives you control over background, outline, etc.

There is a sample of how to use it in the thread: Paragraph text in Pagelayout


You can get around the balloon callout problems by setting the leader tolerance to the maximum, 32767.  A bit of a hack but it works.  Marker text background can work also depending on the needs and the properties.
Another solution is to create a group element with a text element and a polygon or rectangle element grouped together.
0 Kudos
JimCampbell
New Contributor
Thank you for your help
1) ParagraphTextElement
    i. This works but it is much easier to use a rectangle as the background.
    ii. This as the same issues as a rectangle element

2) Use a group and rectangle element. 
    This is what I tried first.  It works but it has issues

Issues with the rectangle and paragraph elements:
   - It causes bad refresh behavior on all my annotations.

See this post for more info:
http://forums.arcgis.com/threads/34481-RectangleElement-causes-annotation-graphics-to-refresh-on-all...


3) Marker Text
    i. Works for the simple markers and bitmaps. 
    ii.  I cannot find a way to make a simple colored bitmap that fits my text.

4) Callout
    i. I have not tried this one yet.
    ii. Is it possible to control the margins around the callout?  This is my only known issue with the callout at this time.  The margins are too big.  It takes up too much screen space.
0 Kudos
AlexanderGray
Occasional Contributor III
callout margins can be set in the ArcMap GUI for the background properties so it should be doable in code.  ITextMargins has a getMargins and putMargins.  I have never used it but my bet would be to start there.
0 Kudos