Aarcgisprosdk10.8 Release
5ac5058d创建于 2020年2月21日历史提交
<!DOCTYPE html>



<html lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>

  <meta charset="utf-8" />

  <title>Draw text on a MapControl</title>

  <style>

    table, th, td {

      border: 1px solid black;

      border-collapse: collapse;

    }

    th, td {

      padding: 5px;

    }

    th {

      font-weight: bold;

    }

  </style>

</head>

<body>

  ## Draw text on a MapControl



  <div xmlns="http://www.w3.org/1999/xhtml" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-02-10T23:25:53">This draw text sample application demonstrates the splined text rendering capabilities of ArcObjects. When you click the map to track a line, the MapControl method DrawText is used to place the text within the text box along the tracked line. At least two clicks are required for the line and text to appear on the MapControl. </div>  



```

Language:              C#, VB

Subject:               Controls

Organization:          Esri, http://www.esri.com

Date:                  10/17/2019

ArcObjects SDK:        10.8

Visual Studio:         2017, 2019

.NET Target Framework: 4.5

```



### Resources



* [ArcObjects .NET API Reference online](http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm)  

* [Sample Data Download](../../releases)  

* [What's new](http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#91cabc68-2271-400a-8ff9-c7fb25108546.htm)  

* [Download the ArcObjects SDK for .Net from MyEsri.com](https://my.esri.com/)  



### Usage

1. Type the text to annotate the map.   

1. Use the left mouse button to trace a line on the map, and use the right mouse button to zoom in.  



#### Additional information  

<div xmlns="http://www.w3.org/1999/xhtml" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-02-10T23:25:53">The application uses the AddLayerFromFile method to load the world continents sample data, which is then symbolized. The OnClick event either uses 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. </div>  



#### See Also  

[MapControl class](http://desktop.arcgis.com/search/?q=MapControl%20class&p=0&language=en&product=arcobjects-sdk-dotnet&version=&n=15&collection=help)  

[IMapControl2 interface](http://desktop.arcgis.com/search/?q=IMapControl2%20interface&p=0&language=en&product=arcobjects-sdk-dotnet&version=&n=15&collection=help)  



---------------------------------



#### Licensing  

<table><tr><th> Development licensing </th><th> Deployment licensing </th></tr>

<tr><td> Engine Developer Kit </td><td> Engine </td></tr>  

<tr><td>  </td><td> ArcGIS Desktop Basic </td></tr>  

<tr><td>  </td><td> ArcGIS Desktop Standard </td></tr>  

<tr><td>  </td><td> ArcGIS Desktop Advanced </td></tr>  

</table>

</body>

</html>