Painting only when your window is visible on the screen
Sometimes you want to perform an activity, such as updating a status window, only as long as the window is not covered by another window. The easiest way to determine this is by not actually trying to determine it. For example, here's how the taskbar clock updates itself: ...