Brahma

Hi,
I am struggling to have a flicker free MDI application which has Multiple child windows.
All the child windows are very rich in nature. The parent MDI only has a panel (docked) with some buttons in it to move between the child screens. All the child windows are invoked in the maximize mode.

There are two scenarios:
1. Painting the child windows: The MDI is invoked and the child windows are invoked for the first time. Here the flicker is quite perceptible. I understand that the forms and the controls are getting painted for the first time and hence the flicker. However is it possible to paint the complete screen in the background and then show the form in one shot so that we don't see the transition. I have tried double buffering but to little effect.

2. Re-activating the child windows: This is rather surprising. When I switch between child forms there is still some flicker. When I switch the windows by clicking on the buttons, all I do is bring the corresponding child windows to front by doing a Form.Show() or Form.BringToFront(). Why should there be any flicker The more intriguing thing is if I do a ctrl+tab to switch between the child form there is no flicker. I want to simulate that behaviour.

Some things I have already tried:
1. Double buffering
2. Put the application.DoEvents() so that the worker thread is blocked until all the messages in the queue are processed
3. Try capturing the paint event and try painting myself

Is there any fast and easy solution to this which I am overlooking Pls. let me know of your thoughts.

TIA,
-Brahma


Re: Windows Forms General Form flickering while switching between MDI children

riz332

I am having the same problem except that in my case the child forms flicker ever if I use ctrl+tab.

When one of the child forms has been maximized, all the child forms open or come to front maximized. But before they are maximized they are shown for second at their original position and it creates a kind of flicker that is very pronounce.

Please help me on this issue. It has become quite frustrating.

Regards,

Rizwan Khalid






Re: Windows Forms General Form flickering while switching between MDI children

Gavin Jin - MSFT

I hope this article will help you

beside this ,many people have met this problem before ,I hope they will give you some advices.

 here is a FAQ






Re: Windows Forms General Form flickering while switching between MDI children

Erasure

I guess no one at MS has any solution for this MDI form flickering problem. This issue has been out for a few years now and there seems to have been no solution provided by MS. This is somewhat frustrating when using VS2005 and following their examples to cread a simple MDI form application. When you have multiple MDI children forms open and their size is maximized you will see considerable flickering when switching between the children. What is the solution What is a viable work around because I have practically scoured throughout Google trying to find any patch fix but none have worked.



Re: Windows Forms General Form flickering while switching between MDI children

nobugz

MDI is not an ideal solution if you routinely maximize MDI child forms. Windows only allows one child to be maximized and forces other children to be restored when you maximize another child. That creates a flurry of paint messages you'll perceive as flickering.

Alternatives are a tabbed interface, similar to the VS IDE, panels or user controls that you create and/or make visible as needed or hosting a form on a parent form or panel by setting the TopLevel property to False.





Re: Windows Forms General Form flickering while switching between MDI children

ANS-Denver

I found the code at http://www.sellsbrothers.com/askthewonk/Secure/HowdoIstoptheflickerinmyM.htm helpful; unfortunately, they're no longer there to thank.

Still having a problem with a TextBox that flashes up in the design position between New() & Load() on the way to maximized form driven by code.






Re: Windows Forms General Form flickering while switching between MDI children

Flippie

Man i found something that i hope will work for you as well.

I have a form by the name of mdiAuthor. The Windowstate MUST be minimized in the design view

Code Block

'Load the form into a variable mdlAuthor as new form. I declared it publically

'for various reasons

mdlAuthor = mdiAuthor

mdlAuthor.MdiParent = mdiMainParent

mdlAuthor.Show()

'Here i hide the thing.

mdlAuthor.Visible = False

'As you can see i basically move it off screen

mdlAuthor.Top = 30

'I think this is in the see

mdlAuthor.Left = 3000

'Size it back

mdlAuthor.WindowState = FormWindowState.Normal

'Now this is interesting. I have been told in another post that this will halt the layout on the front. Needless to say, it did not work as advertised.

mdlAuthor.SuspendLayout()

'Make it visible again while it is off screen.

mdlAuthor.Visible = True

'Move it into position

mdlAuthor.Left = 300

'This bit is a waste as well byt there you have it.

mdlAuthor.ResumeLayout()

And in my case bobs my uncle. Anyway i googled for something like four hours straight and some of the things i saw there hardly made sense and were in C too boot. This is as far as my own creative thinking goes.

Now i have like 50 forms to implement it on.

Anyway if any of you brainiacs found a better solution then please let me know.

I love mdi for the control they provide and as i load it in a variable i can dispose it when i am fed up with it