Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 977
  • Last Modified:

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 ?
0
techsuppoprt
Asked:
techsuppoprt
  • 6
  • 5
1 Solution
 
anarki_jimbelCommented:
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_jimbelCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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_jimbelCommented:
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_jimbelCommented:
Hmmm... Not sure - have to play with that. In our applications we display dialogs as normal forms, not mdi children...
0
 
anarki_jimbelCommented:
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
 
techsuppoprtAuthor Commented:
Let me give it a shot..
0
 
techsuppoprtAuthor Commented:
This will do.
Thank you.
0
 
anarki_jimbelCommented:
Yeah, sorry - I  feel myself a bit uncomfortable when giving negative answers... :)

Anyway - good luck!.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now