Solved

Maximized MDI Form Problem

Posted on 2008-06-13
5
557 Views
Last Modified: 2012-05-05
I like to have a MDI Child Form maximized in the parent form

Now when the parent form ist sized smaller than the child minimal formsize, the parent form should get scrollbars. If the child form is not maximized it works. How can i do this that it also works in maximized mode ?

regards
Chris
0
Comment
Question by:zeebee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 6

Expert Comment

by:Bruce_1975
ID: 21778469
Try this:
don't place the controls directly on the form. Use a panel instead with AutoResize = true;
Place the Panel on the child form with Dockstyle Top.

Regards,
Bruce
0
 

Author Comment

by:zeebee
ID: 21778747
Are there any other solutions because its a very hugh project where the forms are loaded very differently and i can't change every form.

is this a solution which can be added dynamically when showing the form ?
0
 
LVL 6

Accepted Solution

by:
Bruce_1975 earned 250 total points
ID: 21779337
Took a while but finally I got it.
You can overload the OnLoad function of the child forms.
protected override void OnLoad(EventArgs e)
{
    Panel pnlMaster = new Panel();
    pnlMaster.Dock = DockStyle.Fill;
    pnlMaster.AutoScroll = true;
 
    while (this.Controls.Count > 0)
        pnlMaster.Controls.Add(this.Controls[0]);
 
    this.Controls.Add(pnlMaster);
    base.OnLoad(e);
}

Open in new window

0
 

Author Comment

by:zeebee
ID: 21779692
ok this works well on a small testform. i try this in the big project on monday. thanks for this solution.

if anybody other have some solution which can be done more from outside the child form i will be pleased to hear.
0
 
LVL 6

Expert Comment

by:Bruce_1975
ID: 21779735
Hmm..
at my first post i mixed up AutoResize and AutoScroll... sorry for that.

Have a nice weekend!

Regards,
Bruce
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question