Draw text


Purpose
This draw text sample application demonstrates the splined text rendering capabilities of ArcObjects. The user clicks on the map to track a line, and the MapControl method DrawText is used to place the text within the TextBox along the tracked line. Note that at least two clicks are required for the line and text to appear on the MapControl.
 
The application uses the AddShapeFile method to load in the continents 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, thereby removing any previously drawn annotation, and triggering the MapControl's 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

Data has been provided for your use with this sample. It can be found at <Your ArcGIS Developer Kit Install directory>/Samples/data/DefenseSolutions/Continents/Continents.shp.
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 application.
  2. Enter text to annotate the map with.
  3. Use the left hand mouse button to trace a line on the map and the right hand mouse button to zoom in.

DrawText.h Main header file
DrawText.cpp Main implementation file
MapControlEvents.h Event header file
MapControlEvents.cpp Event implementation file
Makefile.SolarisMotif Solaris Project Makefile
Makefile.LinuxMotif Linux Project Makefile
Download the Motif_CPP files

Download the files for all languages




Development licensing Deployment licensing
Engine Developer Kit Engine Runtime