Exercises

Exercise 25.1: What happens if you don’t clear the cMemoryDC?

Comment out the line _pMemDC->clear(clearrect); from the cGraphicsMFC: :clear(const CRect &clearrect) code in graphicsmfc.h and see what happens. Drag a corner of the window to resize it. Can you figure out what’s going on?

Exercise 25.2: Invalidate and flicker

Change the CPopView:: OnEraseBkgnd method to call the default CView method. Look at the flicker.

Exercise 25.3: Writing your own memory CDC code

Occasionally students rebel at using the cMemoryDC class. ‘I want to use my own code; if I have to do this at our job, I want to be able to do it myself.’ But do keep in mind that the MemoryDC.* files (and all the other software in this book) are well-tested public domain ...

Get Software Engineering and Computer Games 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.