VCL controls can call Invalidate() to be placed into a queue for repainting. Fire Monkey controls have a Repaint() method, but AFAICT that forces the control to be repainted immediately.
A queue type system would be more appropriate in some circumstances.
For this reason, if you invalidate a portion of a window, only that area will be repainted. This feature is a double-edged sword: It is a powerful technique that can improve speed and reduce the flickering caused by frequent repaint operations, but, it can also produce incorrect output.
A typical problem occurs when only some of the areas affected by the user operations are modified, while others remain as they were even if the system executes the source code that is supposed to update them.
If a painting operation falls outside the update region, the system ignores it, as if it were outside the visible area of a window.
within formpaint event, it works but it is always invalidating that my program kind of get stuck when you try to do anything else like open dialog box. Invalidate is used for example when you change a property (eg background color) and you want the control to repaint it self.
The first technique, painting, is the common approach to handling output in most windowing systems, aside from particular graphics-oriented programs that store the form's whole image in a bitmap.
The approach used to implement painting has a very descriptive name: store and paint.
There are times when you want to repaint a control immediately, typically to give an indication to the user that something is actually happening during a lengthy bit of processing. Button1Click(Sender: TObject); var I: Integer; Stopwatch: TStopwatch; begin Progress Bar1. If you provide a method to redraw the contents of the form, and if this method is automatically called when a portion of the form has been hidden and needs repainting, you will be able to re-create the output properly.Because this approach takes two steps, you must be able to execute these two operations in a row, asking the system to repaint the window—without waiting for the system to ask for a repaint operation. Elapsed Milliseconds To see this, try reimplementing the VCL demo presented above. Nonetheless, on Windows it is possible to process paint messages for a FMX form using something like the following code: You have to do things at the form level since a FMX control on Windows isn’t backed by its own HWND. Process Messages, as its name implies, processes all messages currently outstanding (paint and otherwise) for all controls (and if there are any other message-handling primitives in the application, those too), which can soon lead to serious re-entrancy issues. Unfortunately the person who mans QC hasn’t understood the point of it, and I wouldn’t be surprised if there are other similar reports on the system.