C # WinForm Forms control the difference between Invalidate, Update, and Refresh

Source: Internet
Author: User

Control.refresh-does an control.invalidate followed by Control.update.
Refresh: Forces the control to invalidate its work area and immediately redraws itself and any child controls. = = Invalidate Update

Control.invalidate-invalidates a specific region of the Control (defaults to entire client area) and causes a paint mess Sent to the control. Invalidate marks the control (region, or rect) as in need of repainting, but doesn ' t immediately repaint (the repaint is T Riggered when everything else have been taken care of and the app becomes idle).
Invalidate: Invalidates a specific area of the control (you can set the area yourself to improve performance) and sends a paint message to the control.
marks the control as requiring repainting, but does not immediately perform a refresh redraw until the system is idle .


Control.update-causes the Paint event to occur immediately (Windows would normally wait until there is no other messages For the windows to process, before raising the Paint event). Update causes the control to immediately repaint if any portions has been invalidated.
Update: Causes the control to redraw an invalid area within its workspace, calling the Paint event immediately. If there is an invalid area, update will trigger the redraw immediately.

The Paint event of course is a where all the drawing of your form occurs. Note There is the only one pending Paint event, and if you are Invalidate 3 times, you'll still only receive one paint event.
Paint: Everywhere. If you call 3 times invalidate, the system will only trigger a paint event .

Most of the time Invalidate are sufficient, and advisable as can do a bunch of invalidations (either explicit or implic It) and then to the control repaint itself when the app is idle. It is advisable to use Update or Refresh when you want the control to immediately repaint because the app won't be idle For a user-noticable period of time.

Most of the time invalidate is sufficient, and when the system is concentrating on a large number of refresh redraws, it is recommended to use invalidate, because the system eventually refreshes only once and improves system performance. If you want to perform a refresh immediately, we recommend that you use the Refresh method.

C # WinForm Forms control the difference between Invalidate, Update, and Refresh

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.