I have designed a radio button custom control. it works fine on my computer but when i port my application on th other machine that doesn’t appear.
any body does know why?
here is part of my control:
public class CustomCheckBox:UserControl
{
public CustomCheckBox()
{
// Height+=50;
count++;
index = count;
Height = 50;
Width = 100;
Region r = new Region(new Rectangle( 0, 0, Width, Height));
this.Region = r;
this.SetStyle(ControlStyles.ResizeRedraw, true);
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED
// cp.Style &= ~0x02000000;
return cp;
}
}
protected override void OnMouseLeave(EventArgs e)
{
paintState = 0;
base.OnMouseLeave(e);
this.Invalidate();
}
...
The problem solved as Hans Passant has commented above, i removed the WS_EX_COMPOSITED style flag which was used to apply drawing optimization to remove flicker on appearance and instead i used this kind of optimization in constructor and it worked fine.