Reputation: 595
Okay so my form has a lot of Nested "Panels" with background images and a lot of buttons on it. Every time the form is shown (Not Minimize/Restore but Hide/Show) the controls flicker as they are rendered onto the screen.
I could use opacity with a minimum delay to render the controls before setting opacity to 100%. But I was wondering if there was a better way to do this. .Net being event driven I was hoping there would be a way to detect when all controls were shown properly on the Winform before "Show"ing the winform itself.
I've tried this::DoubleBuffered=true;
on the Winform but it didn't work out as expected.
Upvotes: 0
Views: 766
Reputation: 581
Someone may explain why, but putting this below method in a form helped me to avoid flickering problems in my panels which has multiple button and image controls. Need to mention that my controls were created (dynamically) at code behind.
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED
return cp;
}
}
Upvotes: 3