Solved

Maximized MDI Form Problem

Posted on 2008-06-13
5
554 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
  • 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

777 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