I'm trying to do a custom label class with transparency and I was searching a lot of articles about this but my case is different cause I'm trying to do a countdown with a transparent label, then when I use the example code below success flickering. I use a timer with interval set to 100 then change the text custom label. I don't know what can I do to get better performance when refreshing, any idea?
class CustomLabel : Label
{
public CustomLabel()
{
this.SetStyle(ControlStyles.Opaque, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
}
protected override System.Windows.Forms.CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x20;
return cp;
}
}
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
RecreateHandle();
}
}
}