Anyway now I need help in case of real resizing, since in this case I need hard-recomputing, I am looking for something that works "after" resizing is complete (eg when the user resize the form with mouse I would like to do a single Hard-refresh at the end of user interaction).
It's impossible to know. Example: The user grabs the edge of the form, and slowly resizes pixel by pixel. When is the resize finished? When the user takes more than 1 second, between two increases? Or half a second? or 2 seconds?...
You could go for on mouse up. I am not sure you can reliable catch that on all OS.
And then, resize could (on some OS) end by the escape key. Or "alt-tab" switching to another window. Or....
It avoids the continous hard-recomputing in the refresh (even if not real resizing is happening, this part for me it is still obscure)).
Earlier you said "repaint". Not sure of your implementation. But you should use "Invalidate". Though that is only part of what you may need.
Invalidate, will schedule a paint event. However, if there are more resize events, and there is no time to paint, then resize events should afaik be handled first. And one combined paint at the end.
However it is imperative, that paint events are fast. If you put big computation in there, the effects can be visible bad.
So you should split
- the work to compute what should be painted (which can potentially take a long time)
- painting the result (i.e. copy a bitmap, or output text at the pre-determined position, or....)
If you do that split, the the question is, where to put the computing so that no blocking happens.
Threads is one possibility.
- But needs careful syncing / and caching, so you have "data in progress" in the thread and "previous-finished-data" to paint.
- Need checking, if the size further changed => so they abort any no longer needed work.
Or you can
- compute in QueueAsync or OnIdle
- only compute small part in each call, and then schedule the next QueueAsync or OnIdle.
(you need state keeping, what has been done, and where to continue)
- if the size further changed, discard the partial work, and start over
(or keep the partial work, if it can be used for some partial updated paint)