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


IMapControlDefault.DrawShape Method (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Controls)  

IMapControlDefault.DrawShape Method

Draws a geometry shape on the MapControl.

[Visual Basic .NET]
Public Sub DrawShape ( _
    ByVal Shape As IGeometry, _
    [ByRef symbol As Object] _
)
[C#]
public void DrawShape (
    IGeometry Shape,
    ref object symbol
);
[C++]
HRESULT DrawShape(
  IGeometry* Shape,
  Variant* symbol
);
[C++]

Parameters Shape [in]
Shape is a parameter of type IGeometry* symbol [in, optional]
symbol is a parameter of type VARIANT*

Product Availability

Available with ArcGIS Engine.

Description

DrawShape draws the supplied geometry onto the display. Use the DrawShape 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

1030 800a0406: The supplied geometry does not have a geometry type that is supported for drawing 

Remarks

Geometry objects implementing IEnvelope, IMultiPatch, IMultiPoint, IPoint, IPolygon and IPolyline are supported. 

[C#]
private void axMapControl1_OnAfterDraw(object sender, ESRI.ArcGIS.MapControl.IMapControlEvents2_OnAfterDrawEvent e)
{
    if (e.viewDrawPhase == (int) esriViewDrawPhase.esriViewForeground)
    {
        //Use DrawShape...
    }
}
[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 DrawShape...
    End If
End Sub

See Also

IMapControlDefault Interface