Draw text


Purpose
This sample application demonstrates the splined text rendering capabilities of ArcObjects. You click the map to track a line, then use the MapControl DrawText method to place the text in the text box along the tracked line. At least two clicks of the mouse are required for the line and text to appear on the MapControl.
 
This sample uses the AddShapeFile method to load the world countries sample data, which is then symbolized. The OnClick event uses either the TrackRectangle method to zoom in if the right or middle mouse button has been used, or adds the new point to the line and updates the display through the Refresh method. The Refresh method is used to draw the esriViewForeground phase, thereby removing any previously drawn annotation and triggering the MapControl OnAfterDraw event. The OnAfterDraw event uses the DrawShape and DrawText methods to draw the line and text onto the MapControl in response to the refresh of the esriViewForeground phase.

How to use

See How to use ArcGIS samples for help on running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Run the DrawText application.
  2. Type text in the text box.
  3. Use the mouse button to trace a line for drawing text.


Download the files for Java
mapbean/DrawText.java Main class




Development licensing Deployment licensing
Engine Developer Kit Engine Runtime
ArcView
ArcEditor
ArcInfo