Reducing Flicker by Using Double Buffering
You may have noticed that even with the relatively simple samples described so far, the screen does not paint all at once. If you use more complex drawing, or you are trying to simulate animation effects by repeatedly repainting an object while moving its position, you will notice a pronounced flickering effect that spoils the results.
The solution to this issue is a technique called double buffering, which simply entails creating a background buffer, drawing to the buffer, and painting the result to the screen only when all drawing is complete. One implementation of double buffering is shown in Example 12-3. (The designer-generated code is not shown; you will have to hook up the Form.Resize event to get ...
Get Microsoft® Mobile Development Handbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.