The invalidate function marks the drawing area as invalid. This flag is used when the window is redrawn; if the region is invalid, it will redraw the region if it does not leave the region of the screen as it is. invalidate invalidates the entire client area of ββthis object; invalidaterect invalidates the specific region of the client area. The update function performs the actual redraw.
The reason for this mechanism, and not just drawing right away when you know something, needs to be changed, is that you can prevent multiple redraws, for example, for example, you received three chat messages at a time that scroll through some text area . If you change the text area for each keystroke, you will have to draw the text area three times, and the application will stop responding. Instead of processing all key events, updating the data structure attached to the text area, and invalidating the text area before you redraw the text field, you redraw the text field only once.
wich
source share