After the non-modal dialog box is displayed in the MFC Main Dialog Box, the non-modal dialog box cannot be refreshed.

Source: Internet
Author: User

I placed a picture control and some edit and button controls for MFC in the non-modal dialog box, but I used the following function to refresh

Invalidate ();

Updatewindow ();

 

Cannot refresh

 

Later we found that:

Bool onerasebkgnd (CDC * PDC)
{
// Todo: add the message processing program code and/or call the default value here
 
Return false;
}

 

A problem occurs here. I directly return false to this function, and the background cannot be refreshed. However, after I change the function back,

Bool onerasebkgnd (CDC * PDC)
{
// Todo: add the message processing program code and/or call the default value here
 
Return cdialog: onerasebkgnd (PDC );
}

 

I can refresh the background, but I drew a rectangle on the picture control, which is flickering. I haven't solved it yet. I searched the internet and used double buffering. Then I went on to test it.

 

I didn't use double buffering later. I directly put the code for the rectangle

Pwnd-> invalidate ();
Pwnd-> updatewindow ();

The backend will not flash.

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: info-contact@alibabacloud.com 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.