Microsoft KB Archive/63169

INF: PM Sample Program That Paints Invalid or Visible Areas PSS ID Number: Q63169 Article last modified on 09-09-1991 PSS database name: P_PresMan

1.10 1.21

OS/2

Summary:

In the Software/Data Library is a file named VALIDPNT that demonstrates how to paint only those parts of the window that are invalid, rather than everything inside of the bounding rectangle of the invalid region.

In simple cases these will be the same; however, when a window that has several parts obscured by multiple other windows is brought to the front, the update region will be complex and the bounding rectangle will include more than the actual dirty areas. Painting only the invalid areas will save time when painting is costly.

By knowing the update region instead of just the bounding rectangle that WinBeginPaint returns, the application can paint only the areas that have been dirtied. If the application needs to repaint areas because they have changed, it can force partial repaints by calling WinInvalidateRect or WinInvalidateRegion.

The sample also shows how to invalidate just the visible areas of the window to ensure that they will generate an update region in the next WM_PAINT message. This can be useful for animating windows in the background.

VALIDPNT can be found in the Software/Data Library by searching on the word VALIDPNT, the Q number of this article, or S12616. VALIDPNT was archived using the PKware file-compression utility.

Copyright Microsoft Corporation 1991.