@unknownuser said:
The WM_PAINT message is generated by the system and should not be sent by an application. (source
@unknownuser said:
Most drawing carried out during processing of the WM_PAINT message is asynchronous; that is, there is a delay between the time a portion of the window is invalidated and the time WM_PAINT is sent. During the delay, the application typically retrieves messages from the queue and carries out other tasks. The reason for the delay is that the system generally treats drawing in a window as a low-priority operation and works as though user-input messages and messages that may affect the position or size of a window will be processed before WM_PAINT . (source
so .invalidate pushes WM_PAINT in message queue which will call the draw method from WindowProc sometime later and .refresh will immediately call the draw method.
too many .refresh will result in a slower workflow due unnecessary redraws instead of mixing all (system + code) in one draw.