Search This Blog

Saturday, October 25, 2008

FlowLayoutPanel FLickers when Controls added

Discussion Thread

Potential Solution:
Add the following code to add being added.

Add following code to Class Constructor

SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);

protected override CreateParams CreateParams {
get {
// Turn on the WS_EX_TRANSPARENT style
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x20;
return cp;
}
}

example:

public PhotoAccount(Account acct)
{ _acct = acct;
InitializeComponent();
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);

RefreshAccountSpace();
txtAccount.MouseClick += new MouseEventHandler(txtAccount_MouseClick);
txtAccount.MouseDoubleClick += new MouseEventHandler(txtAccount_MouseDoubleClick);
}

protected override CreateParams CreateParams
{
get
{
// Turn on the WS_EX_TRANSPARENT style
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x20;
return cp;
}
}

No comments: