Our company needed an MDI form where the children were always maximized and would not let the user minimize or restore the children forms. Also needed to be able to navigate between the child forms.
Setting the children's Controlbox, MinBox and MaxBox to false also setting the windowstate = Maximize and FormBorderStyle = None didn't work. The parent still contained the control boxes to minimize, restore or close the child form.
After trying several variations, we came up with the following solution which worked exactly the way we needed it to. Simply create a project with three forms setup as specified below. It should look similar to this:
Setup: Form1 Properties: IsMdiContainer = True
Listbox1 docked to left of Form1. ImageList1 contains one image.
Form2 and Form3 Properties: WindowState = Normal
Form2 has a label with Label1.Text = "2"
Form3 has a label with Label1.Text = "3"
Public Class Form1 Dim frm2 As New Form2 Dim frm3 As New Form3
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load frm2.MdiParent = Me frm2.Dock = DockStyle.Fill Me.ListView1.Items.Add(frm2.Text, 0) frm2.Show() frm3.MdiParent = Me frm3.Dock = DockStyle.Fill Me.ListView1.Items.Add(frm3.Text, 0) frm3.Show() End Sub
Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged Dim lv As ListView = CType(sender, ListView)
Select Case lv.FocusedItem.Text Case frm2.Text frm3.Hide() frm2.Show() Case Else frm2.Hide() frm3.Show()