Analysis of the implementation method of using double buffering under WTL _c language

Source: Internet
Author: User
Using WTL's Cdoublebufferimpl class makes it easy to implement double buffering without having to implement cumbersome code yourself, not only to draw a general window, but also to draw the background of a dialog box.
First #include <atlframe.h>
Secondly, the class needing double buffering drawing should derive from Cdoublebufferimpl<>
Class Cmaindlg:public Cdialogimpl<cmaindlg>, Public cdoublebufferimpl<cmaindlg>{}
Then the message chain joins
Chain_msg_map (cdoublebufferimpl<cmaindlg>)
End_msg_map ()
Finally write the DoPaint function, directly to draw on the
void DoPaint (Cdchandle DC)
{//Draw a rectangle
dc. Rectangle (0, 0, 10, 10);
Into the.
Note that because the Cdoublebufferimpl class responds to WM_PAINT messages and WM_ERASEBKGND messages, there is no need to respond in your own class.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.