CreateParams occurs - Window handle exception

598 Views Asked by At

I am using CreateParams on my own Tabcontrol to get rid of its flickering meanwhile resizing and loading. It's just an empty class where I implemented CreateParams.

protected override CreateParams CreateParams
{
    get
    {
        CreateParams cp= base.CreateParams;
        cp.ExStyle |= 0x02000000;  // Turn on WS_EX_COMPOSITED  
        return cp;
    }
} 

It's working well if you have labels, textboxes or buttons and on Windows 7. But if you have panels, tablelayoutpanel, datagridview, and Windows XP then it's working not so fine. Columns of a datagridview for example don’t appear in a proper way.

I also found the following that someone posted, if the current system is Windows XP. But this occurs on my XP a window handle exception before launch of the window. With 0x02000000 only it's loading but as I wrote the columns don't appear in a proper way.

cp.ExStyle |= 0x02000000;  // Turn on WS_EX_COMPOSITED
cp.ExStyle |= 0x00080000;  // Turn on WS_EX_LAYERED (On XP System)

Does anyone knows any workaround regarding the flickering and integrated datagridview, without getting this exception?

0

There are 0 best solutions below