Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Maximized MDI Form Problem

Posted on 2008-06-13
5
Medium Priority
?
560 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 1000 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

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

926 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