Arti
Arti

Reputation: 3071

Winform Application flickers on XP system

Hi I have a windows application (winform .net framework 4). The app is flickering alot on windows XP system. I added code:

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

The flickers were removed when I added above code. It worked fine on my development system which is windows 7 32 bit but On Windows XP the flickers has increased and also the background image is not loaded.

Is there any way by which flickers can be removed in all the windows OS?

Upvotes: 1

Views: 239

Answers (2)

Ben
Ben

Reputation: 3391

Here is some information about Double Buffering. This is a built-in feature that is turned off by default. In my experience it doesn't always help but it is worth trying.

To turn it on, open the designer and select the form and look in the Properties of the form. Under the category 'Behavior' you will find the DoubleBuffered property. Just set this to true.

enter image description here

Upvotes: 1

aush
aush

Reputation: 2108

You may also try

SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);

Upvotes: 1

Related Questions