Quantcast
Channel: CoryBorrow.Blog();
Viewing all articles
Browse latest Browse all 8

C# Remove flickering in MDI applications.

$
0
0

If you have ever been working with MDI applications, and while to MDI windows are while the MDI windows are maximized and you switch you see a flicker of the windows.

Well below is a simple quick fix for solving this issue.

So firstly lets define some constants that we will be using.


const int WM_NCPAINT = 0x85;
const int WM_SIZE = 0x05;

Now override the WndProc method in the MDI child window(s).


protected override void WndProc(ref Message m)
{
    if (m.Msg == WM_NCPAINT) 
    {
        if(this.WindowState == FormWindowState.Maximized)
            return;
    }

    if (m.Msg == WM_SIZE)
    {
        if (this.WindowState == FormWindowState.Maximized)
            return;
    }

     base.WndProc(ref m);
}

and viola your flickering issues are gone.


Viewing all articles
Browse latest Browse all 8

Trending Articles