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

IScreenDisplay.Invalidate Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Display > ESRI.ArcGIS.Display > Interfaces > IS > IScreenDisplay Interface > IScreenDisplay.Invalidate Method
ArcGIS Developer Help

IScreenDisplay.Invalidate Method

Cause the specified area of the specified cache to redraw.

[Visual Basic .NET]
Public Sub Invalidate ( _
    ByVal rect As IEnvelope, _
    ByVal erase As Boolean, _
    ByVal cacheIndex As Short _
public void Invalidate (
    IEnvelope rect,
    bool erase,
    short cacheIndex
HRESULT Invalidate(
  IEnvelope* rect,
  short cacheIndex
rect [in]

rect is a parameter of type IEnvelope* erase [in]
erase is a parameter of type bool cacheIndex [in]
cacheIndex is a parameter of type short

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.


Use Invalidate to refresh a specific region on the display.  For example, if you add a new feature, only the extent of the new feature requires refreshing; the remainder of the display can redraw from cache.

The rect parameter specifies the region to update.  Use 'Nothing' in Visual Basic or a zero in C++ to invalidate the entire display.

Erase specifies whether or not the background within the update region is erased when the update region is processed.  Usually this is set to TRUE.

CacheIndex controls which cache to update.  Use IActiveView::ScreenCacheID to get the cache index for a specific draw phase.  The valid draw phases are held in the esriViewDrawPhase enumeration and are as follows:

0 - esriViewNone
1 - esriViewBackground
2 - esriViewGeography
4 - esriViewGeoSelection
8 - esriViewGraphics
16 - esriViewGraphicSelection
32 - esriviewForeground

You can also specify esriAllScreenCaches, esriNoScreenCache, and esriScreenRecording.

Invalidate sets the cache(s) as dirty.  Use IsCacheDirty to check the state of a particular cache.

After completion, Invalidate fires the IDisplayEvents::DisplayInvalidated event.

IActiveView::PartialRefresh has similar parameters and itself calls Invalidate. Use this method instead as much as possible as it automatically determines the cache index based on the phase provided.

See Also

IScreenDisplay Interface | IActiveView.Refresh Method | esriViewDrawPhase Constants | IActiveView.ScreenCacheID Property | IActiveView.PartialRefresh Method | IScreenDisplay.Invalidate Method