ArcObjects Library Reference (Controls)  

IMapControl3.Refresh Method

Redraws the Map, optionally just redraw specified phases or envelope.

[Visual Basic .NET]
Public Sub Refresh ( _
    [ByVal phase As esriViewDrawPhase], _
    [ByVal layerOrElement As Object], _
    [ByVal envelope As Object] _
)
[C#]
public void Refresh (
    esriViewDrawPhase phase,
    object layerOrElement,
    object envelope
);
[C#]

Optional Values

phase   Supply 65535 as a default value.
layerOrElement   To indicate that this parameter is undefined, pass in Type.Missing.
envelope   To indicate that this parameter is undefined, pass in Type.Missing.
[C++]
HRESULT Refresh(
  esriViewDrawPhase phase,
  VARIANT layerOrElement,
  VARIANT envelope
);
[C++]

Parameters

phase [in, optional, defaultvalue(65535)]

  phase is a parameter of type esriViewDrawPhase

layerOrElement [optional]   layerOrElement is a parameter of type VARIANT

  To indicate this parameter is undefined pass in a VARIANT with type VT_ERROR and scode value of DISP_E_PARAMNOTFOUND.

envelope [optional]   envelope is a parameter of type VARIANT

  To indicate this parameter is undefined pass in a VARIANT with type VT_ERROR and scode value of DISP_E_PARAMNOTFOUND.

Product Availability

Available with ArcGIS Engine.

Description

Use the Refresh method to redraw the display. If the Refresh method is used and no arguments are supplied the refresh is based upon the IActiveView::Refresh method.

In all other cases the refresh is based upon the IActiveView::PartialRefresh method. The Refresh method supports the esriViewDrawPhases given below:

0   :esriViewNone

1   :esriViewBackground

2   :esriViewGeography

4   :esriViewGeoSelection

8   :esriViewGraphics

16 :esriViewSelection

32 :esriViewForeground

If the Refresh method is used and no phase argument is supplied, but one of the other arguments is supplied then all phases will be refreshed and the phase value will be 65535. Always supply a phase whenever possible to increase efficiency.

Use the layerOrElement argument to refresh a particular layer or graphic element. Use the envelope argument to refresh only a particular region. For example, if a new graphic is added you may only want to refresh the area surrounding the graphic.

Remarks

Use the TrackCancel object to set whether users can stop drawing processes by using the escape or spacebar keys or by clicking the mouse.

When selecting features, Refresh must be called twice, once before and once after the selection operation.

[C#]

//Based upon IActiveView::Refresh
axMapControl1.Refresh((esriViewDrawPhase) 65535, Type.Missing, Type.Missing);

//Based upon IActiveView::PartialRefresh
axMapControl1.Refresh(esriViewDrawPhase.esriViewGraphics, Type.Missing, Type.Missing);              //Refresh all elements
axMapControl1.Refresh(esriViewDrawPhase.esriViewGraphics, element, Type.Missing);    //Refresh an element
axMapControl1.Refresh(esriViewDrawPhase.esriViewGraphics, Type.Missing, envelope); //Refresh an envelope

[Visual Basic .NET]

'Based upon IActiveView::Refresh
AxMapControl1.Refresh()

'Based upon IActiveView::PartialRefresh
AxMapControl1.Refresh(esriViewDrawPhase.esriViewGraphics)              'Refresh all elements
AxMapControl1.Refresh(esriViewDrawPhase.esriViewGraphics, pElement)    'Refresh an element
AxMapControl1.Refresh(esriViewDrawPhase.esriViewGraphics, , pEnvelope) 'Refresh an envelope

See Also

IMapControl3 Interface

.NET Samples

Network Analyst Engine application (Code Files: frmMain) | Temporal statistics (Code Files: MainForm) |