Hello
The idea is to do the painting on Idle. This means you simple invalidate when being sized and then do your full paint when the size completes. Here is the code that you would add to your form.
bool idleHooked = false;
protected override void OnResize(EventArgs e)
{
if (!idleHooked)
{
Application.Idle += new EventHandler(OnIdle);
}
}
private void OnIdle(object s, EventArgs e)
{
Invalidate();
PerformLayout();
if (!idleHooked)
{
Application.Idle -= new EventHandler(OnIdle);
}
}
Hope this can help you.
Cookie Luo[MSFT]
MSDN Community Support |
Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
