Solved

Maximize Child Form inside MDI parent, VB.NET

Posted on 2010-08-25
5
10,906 Views
Last Modified: 2012-05-10
How do I maximize the child form so it fills the MDI Parent?
My MDI parent fills the entire monitor, but the child only fills a portion of the MDI Parent.  Since I dont' always know what resolution someone will be viewing at, I can't really hard code this.

Any ideas?

Thanks!
0
Comment
Question by:slightlyoff
[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
5 Comments
 
LVL 17

Accepted Solution

by:
Zhaolai earned 500 total points
ID: 33523584
Set your MDI child form's Dock property to Fill, like this,

        Form1.MdiParent = Me
        Form1.Dock = DockStyle.Fill
        Form1.Show()


0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 33523929
Set the WINDOWSTATE of the MdiChild to Maximized and it will fill the entire MdiParent...
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim f2 As New Form2
        f2.MdiParent = Me
        f2.WindowState = FormWindowState.Maximized
        f2.Show()
    End Sub

End Class

Open in new window

1
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 33525054
Just FYI, the two answers above produce different results...the "correct" one depends on your app I suppose.  =)

Dock.Fill doesn't merge with the MdiParent or update the main Form caption while WindowState.Maximized does:
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim f2 As New Form2
        f2.mdiparent = Me
        f2.Dock = DockStyle.Fill
        f2.Show()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim f2 As New Form2
        f2.MdiParent = Me
        f2.WindowState = FormWindowState.Maximized
        f2.Show()
    End Sub

End Class

Open in new window

MdiChildDockFilled.jpg
MdiChildWindowstateMaximized.jpg
0
 
LVL 1

Author Comment

by:slightlyoff
ID: 33525160
I appreciate the insight.  I saw that it worked and awarded the points (i didn't get a chance to test your solution) - but I can see where your answer is correct as well.

thank you for going the extra mile to explain the difference!  It's helpful for a newb like me.
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 33525247
No problem...good luck!
1

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

717 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