Solved

Maximized MDI Form Problem

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now