This document is archived and information here might be outdated.  Recommended version.


IMapControl4.DrawText Method (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Controls)  

IMapControl4.DrawText Method

Draws text along the supplied geometry.

[Visual Basic .NET]
Public Sub DrawText ( _
    ByVal pGeometry As IGeometry, _
    ByVal text As String, _
    [ByRef pSymbol As Object] _
)
[C#]
public void DrawText (
    IGeometry pGeometry,
    string text,
    ref object pSymbol
);
[C#]

Optional Values

pSymbol   To indicate that this parameter is undefined, first define a variable object Missing=Type.Missing; then pass this in as ref Missing.
[C++]
HRESULT DrawText(
  IGeometry* pGeometry,
  BSTR text,
  VARIANT* pSymbol
);
[C++]

Parameters pGeometry [in]
pGeometry is a parameter of type IGeometry text [in] text is a parameter of type BSTR pSymbol [optional] pSymbol is a parameter of type VARIANT
To indicate this parameter is undefined pass a reference to a VARIANT with type VT_ERROR and scode value of DISP_E_PARAMNOTFOUND.

Product Availability

Available with ArcGIS Engine.

Description

DrawText draws a text string around a specified geometry. Use the DrawText method within the esriViewForeground phase of the IMapControlEvents2::OnAfterDraw event.

Errors Returned

1025 800a0401: The specified symbol does not indicate the correct type of object

[C#]
private void axMapControl1_OnAfterDraw(object sender, ESRI.ArcGIS.MapControl.IMapControlEvents2_OnAfterDrawEvent e)
{
    if (e.viewDrawPhase == (int) esriViewDrawPhase.esriViewForeground)
    {
        //Use DrawText...
    }
}
[Visual Basic .NET]
Private Sub AxMapControl1_OnAfterDraw(ByVal sender As Object, ByVal e As ESRI.ArcGIS.MapControl.IMapControlEvents2_OnAfterDrawEvent) Handles AxMapControl1.OnAfterDraw
    If e.viewDrawPhase=esriViewDrawPhase.esriViewForeground Then
        'Use DrawText...
    End If
End Sub

See Also

IMapControl4 Interface | IMapControl3.DrawShape Method | IMapControl2.DrawShape Method | IMapControl4.DrawShape Method | IMapControl3.FlashShape Method | IMapControl4.FlashShape Method | IMapControl2.FlashShape Method