Draw text

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 mouse clicks 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.

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

If you installed the samples feature, you will find the files associated with this sample in <Your Developer Kit install location>\DeveloperKit10.4\Java\Samples\ArcObjects.

mapbean/DrawText.java Main class.

Development licensing Deployment licensing
Engine Developer Kit Engine
ArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced