What is the use of the invalidate () function?

Source: Internet
Author: User
This function in C ++ will be used to refresh the window, And will invalidate the area. I don't know how this function works? Thank you for your consideration.
Void invalidate (bool berase = true );
This function is used to invalidate the entire window client area. If the customer area of the window is invalid, it indicates that re-painting is required. For example, if a window that is covered by other windows is changed to a front-end window, the originally covered window is invalid and needs to be re-painted. In this case, Windows will place the wm_paint message in the message queue of the application. MFC provides the message processing function onpaint of wm_paint for the window class. onpaint is responsible for repainting the window. There are some exceptions to the View class. The ondraw function is called in the onpaint function of the View class, and the actual re-painting is completed by ondraw. If the berase parameter is true, the background in the repainting area is erased. Otherwise, the background remains unchanged.

It differs from updatewindow () in the following ways:

Updatewindow () is used to re-paint the window immediately. After the invalidate and other functions are called, the window will not be re-painted immediately. This is because the priority of the wm_paint message is very low. It must be processed after other messages in the message queue are sent. You can call the updatewindow function to send wm_paint directly to the target window, causing the window to be re-painted immediately.

What is the use of the invalidate () function?

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.