Problem with Maximazing - Restoring windows forms in MDI application

Hi Experts.

I have the weirdest problem...

I have an MDI application where most children forms have:

this.WindowState = FormWindowState.Maximized
in the Form load event to make sure that forms are Maximized.

Some other children forms that act like Dialog Boxes have

this.WindowState = FormWindowState.Normal

in the form event because I dont want them to be maximized, I want popup dialog boxes to be in the original form size.

The problem here is that Maximized background form graphics get completely screwed up every time "Normal sized" form is displayed on top.

Does anyone know what's going on here ? Do you need to see a screenshot ?
LVL 1
techsuppoprtAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

anarki_jimbelSenior DeveloperCommented:
Haven't heard abot such problems. Yeah, screenshot might be useful...
0
techsuppoprtAuthor Commented:
Two screenshots are attached.

The first one shows and MDI child form and the second shows a dialog box on top of the form with FormWindowState set to Normal.
Notice that the background Form gets resized to "Normal" as well and graphics get messed up.

Any idea what's going on ?

Thank you.
beforescreenshot.JPG
afterscreenshot.JPG
0
anarki_jimbelSenior DeveloperCommented:
Hmm... How do you show dialog forms? Dialogs can't be inside the MDI container. May be that't the reason?
Usually exception happens, never seen like tha...
0
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

techsuppoprtAuthor Commented:
Well yeah, the popup form's MDIParent is set to this.MDIParent.

I have to open it within the MDI container to avoid another window open down in the task bar... don't I ?
0
anarki_jimbelSenior DeveloperCommented:
Do you call Show(0 or ShowDialog()?

If you want to stop a form to be shown in the task bar just set it's property ShowIntaskbar = false
0
techsuppoprtAuthor Commented:
basically this:

Form1 newForm=new Form1();
newForm.MDIParent = this.MDIParent;
newForm.Show();


ShowDialog() doesn't work with MDI I believe.

and once the form opens up it has
this.WindowState = FormWindowState.Normal  in the Form load event.
0
anarki_jimbelSenior DeveloperCommented:
Hmmm... Not sure - have to play with that. In our applications we display dialogs as normal forms, not mdi children...
0
anarki_jimbelSenior DeveloperCommented:
OK, I know what's the problem. Unfortunately, you can not have some MDI children maximized but others - in the Normal state. Either all maximized or all in the normal win state. No way around. MDI designed this way. Even if you try to maximize one window - it will ve "normalized", and this screwes the picture (backgrownd might be still filled with the "maximized" window graphics).

So, you have two options:

1. Display dialogs as non MDI children

2. Also maximize mdi child dialog. In this case it will occupy entire mdi area, of course.

Can't see any alternative.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
techsuppoprtAuthor Commented:
Let me give it a shot..
0
techsuppoprtAuthor Commented:
This will do.
Thank you.
0
anarki_jimbelSenior DeveloperCommented:
Yeah, sorry - I  feel myself a bit uncomfortable when giving negative answers... :)

Anyway - good luck!.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.