I (finally!) found a way of rendering Windows.Forms controls on glass that doesn\'t seem to have any major drawback nor any big implementation time. It\'s inspired by this artic
I had a problem with flickering before (lots of controls on the form, user controls). Tried almost everything. This is what worked for me:
Have you tried putting this in your form class?
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000; // WS_EX_COMPOSITED
cp.ExStyle |= 0x00080000; // WS_EX_LAYERED
return cp;
}
}
And in your constructor you have to enable double buffering, otherwise it won't work:
this.DoubleBuffered = true;
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
It only works when aero is enabled, if not it can make flickering even worse.
and you can also add this
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000; // WS_EX_COMPOSITED
return cp;
}
}
to your UserControls class.