What's the difference between the methods:
What's the difference between the methods:
The Invalidate method only marks the component to be painted the next time the interface is updated. It does not re-draw the component at the time it was called.
Method that re-wishes the component immediately, as long as it has already been invalidated, without waiting for the processing of the re-draw messages by Windows. Generates processor time consumption because you will stop all activities from the main application thread to redraw.
This means that if you have changed something that implies a visual change, and the component has not been invalidated, after the update the change may not be processed.
Repaint forces the component to re-draw immediately. If the ControlStyle
property includes csOpaque
, the component will be redrawn, otherwise the Invalidate
method will be executed and soon the Update
According to the documentation, the Refresh
executes the Repaint
, and therefore exactly do the table thing, both of which are interchangeable, that is, either use one or the other
Force the application to process Windows messages.
When the application is performing a high-cost operation, or looping, the thread gets busy performing that operation and does not process any Windows messages to the application, such as a click on a component , keystroke or in this case update the graphic components of the application.
If you call the Invalidate
method and soon after Application.ProcessMessages
, windows will handle the Invalidate message and arrange the re-drawing of the window or component together with all other messages.