Question from a client: "If I resize the window, I get 2 calls to 'OnLayerPaint' when there should be only one. If I just click on the map (the view displaying the XGIS_ViewerWnd), I get a single call to 'OnLayerPaint' when there should be none. These extra paints cause the application to flicker and slow down during some operations. Is there a way to get rid of the extra paints?"
There are a few states of Painting in DrawMode:
- gisDrawAll - all layers are painted
- gisDrawAllExceptTop - all layers except the top layer are painted
- gisDrawTop- only the top layer is painted
Also, InIncrementalPaint informs you if all of incremental paints are to be performed. Thanks to this, you can abandon painting of a selected layer in incremental mode.
In default mode the DK draws layers two times, with an initial fast draw and a second precision draw. This is how the DK ensures proper label placement so no labels are hidden by features in a different layer, rotation of labels to best fit to lines, positioning of labels within polygons, etc. The two step drawing process also offers advantages for map dragging process or when the map moves across the screen such as with GPS tracking. In such situations the DK performs only the fast draw while the screen is moving and performs the precision draw when there is a brief pause in the screen movement.
To turn the incremental (two step) drawing procedure off for any given layer, set
Layer.IncrementalPaint = False
To turn the incremental (two step) drawing process off in the overall viewer, set
Viewer.IntermentalPaint = False