PartialRefresh方法是部分刷新,效率方面比单纯的Refresh方法高很多。调用Refresh总是绘画毎一个对象。这是非常低效的。所以应该多使用PartialRefresh方法而少用Refresh。

刷新图层: pMap.PartialRefresh(esriViewGeography, pLayer, null);

刷新所有图层: pMap.PartialRefresh(esriViewGeography, null, null);

刷新所选择的对象: pMap.PartialRefresh(esriViewGeoSelection, null, null);

刷新标注: pMap.PartialRefresh(esriViewGraphics, null, null);

刷新图元 pLayout.PartialRefresh(esriViewGraphics, pElement, null);

刷新所有图元 pLayout.PartialRefresh(esriViewGraphics, null, null);

刷新所选择的图元 pLayout.PartialRefresh(esriViewGraphicSelection, null, null);

特殊的对于清除选择集,要在清除前后均进行一次刷新


1: public void ClearSelectedMapFeatures(ESRI.ArcGIS.Carto.IActiveView activeView, ESRI.ArcGIS.Carto.IFeatureLayer featureLayer)
2: {
3:   if(activeView == null || featureLayer == null)
4:   {
5:     return;
6:   }
7:   ESRI.ArcGIS.Carto.IFeatureSelection featureSelection = featureLayer as ESRI.ArcGIS.Carto.IFeatureSelection; // Dynamic Cast
8:   // Invalidate only the selection cache. Flag the original selection
9:   activeView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeoSelection, null, null);
10:   // Clear the selection
11:   featureSelection.Clear();
12:   // Flag the new selection
13:   activeView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeoSelection, null, null);
14: }


另外,对于如果对地图进行刷新、闪烁的时候,会出现先闪烁后刷新的问题,这是要添加相应的语句进行处理。


1: m_activeView.Refresh();//或者是某种部分刷新的语句
2: m_mapControl.FlashShape(...);


出现这个问题好像是由于图形显示和闪烁不在同一个线程中执行导致的。闪烁图形是一个很快的操作,而刷新背景却需要比较复杂的计算,所以先出来的语句 后执行结束。使用 m_activeView.UpdateWindow后就可以让代码在此等待。等到刷新确实搞定了。才开始执行FlashShape。使用下面的方法就可以解决这个问题:


1: m_activeView.Refresh().//获者是某种部分刷新语句
2: m_activeView.UpdateWindow();//这条语句是关键 。
3: m_mapControl.FlashShape(...);