Void CTest: OnPaint () {CPaintDC dc (this); // device context for painting // TODO: Add your message handler code here // Do not call CWnd :: onPaint () for painting messages CPoint ptCenter; CRect rect, ellipseRect; GetClientRect (& rect); ptCenter = rect. centerPoint (); // memory dc cdc dcMem used to buffer plotting; // bitmap CBitmap bmp containing temporary images in the memory; // The attached window DC creates compatible memory DC dcMem. createCompatibleDC (& dc); // create a compatible bitmap bmp. createCompatibleBitmap (& dc, rect. width (), rect. height (); // select the bitmap into the memory DC dcMem. selectObject (& bmp); // fill the customer area according to the original background, otherwise it will be black dcMem. fillSolidRect (rect, dc. getBkColor (); // make the same concentric circular image for (int I = 20; I> 0; I --) {ellipseRect on the memory DC. setRect (ptCenter, ptCenter); ellipseRect. inflateRect (I * 10, I * 10); dcMem. ellipse (ellipseRect);} // copy the image from the memory DC to the front-end dc. bitBlt (0, 0, rect. width (), rect. height (), & dcMem, 0, 0, SRCCOPY); // Delete DC dcMem. deleteDC (); // deletes the bitmap bmp. deleteObject ();}