About Multi-MDI

  • Thread starter Thread starter Guest
  • Start date Start date
Fix your date.

--
Jim Carlock
http://www.microcosmotalk.com/
Post replies to the newsgroup.


Hello
There is two buttons(button1 and button2) in left of a parent
Form(frmParent), i want to show two MDI Form(subForm1 and subForm2) on
right, when click button1, subForm1 shown, click button2, subForm2 shown. I
wirtten some code, but when maximize frmParent, subForm can not be shown
right. Please help me.

**********************************************************
'frmMain

Private oSubForm1 As Form
Private oSubForm2 As Form

Private Sub frmParent_Load(...)
Me.IsMdiContainer = True
oSubForm1 = New subForm1
oSubForm1.MdiParent = Me
oSubForm1.Show()
End sub

Private sub button1_Click(...)
oSubForm1.Activate()
End sub

Private sub button2_Click(...)
If oSubForm2 Is Nothing Then
oSubForm2 = New subForm2()
oSubForm2.MdiParent = Me
oSubForm2.Show()
Else
subForm2.Activate()
End If
End sub

'subForm1
Private subForm1_Load(...)
Me.ControlBox = False
Me.WindowState = FormWindowState.Maximized
Me.StartPosition = FormStartPosition.Manual
End Sub

'subForm
Private subForm2_Load(...)
Me.ControlBox = False
Me.WindowState = FormWindowState.Maximized
Me.StartPosition = FormStartPosition.Manual
End Sub

**************************************************************************
 
* "yxq said:
Hello
There is two buttons(button1 and button2) in left of a parent
Form(frmParent), i want to show two MDI Form(subForm1 and subForm2) on
right, when click button1, subForm1 shown, click button2, subForm2 shown. I
wirtten some code, but when maximize frmParent, subForm can not be shown
right. Please help me.

**********************************************************
'frmMain

Private oSubForm1 As Form
Private oSubForm2 As Form

Private Sub frmParent_Load(...)
Me.IsMdiContainer = True
oSubForm1 = New subForm1
oSubForm1.MdiParent = Me
oSubForm1.Show()
End sub

Private sub button1_Click(...)
oSubForm1.Activate()
End sub

Private sub button2_Click(...)
If oSubForm2 Is Nothing Then
oSubForm2 = New subForm2()
oSubForm2.MdiParent = Me
oSubForm2.Show()
Else
subForm2.Activate()
End If
End sub

'subForm1
Private subForm1_Load(...)
Me.ControlBox = False
Me.WindowState = FormWindowState.Maximized
Me.StartPosition = FormStartPosition.Manual
End Sub

'subForm
Private subForm2_Load(...)
Me.ControlBox = False
Me.WindowState = FormWindowState.Maximized
Me.StartPosition = FormStartPosition.Manual
End Sub

If the child form is maximized, it covers the whole free space inside
the MDI container. If one child is maximized, the other children are
maximized too. That's by design.
 
Hello
There is two buttons(button1 and button2) in left of a parent
Form(frmParent), i want to show two MDI Form(subForm1 and subForm2) on
right, when click button1, subForm1 shown, click button2, subForm2 shown. I
wirtten some code, but when maximize frmParent, subForm can not be shown
right. Please help me.

**********************************************************
'frmMain

Private oSubForm1 As Form
Private oSubForm2 As Form

Private Sub frmParent_Load(...)
Me.IsMdiContainer = True
oSubForm1 = New subForm1
oSubForm1.MdiParent = Me
oSubForm1.Show()
End sub

Private sub button1_Click(...)
oSubForm1.Activate()
End sub

Private sub button2_Click(...)
If oSubForm2 Is Nothing Then
oSubForm2 = New subForm2()
oSubForm2.MdiParent = Me
oSubForm2.Show()
Else
subForm2.Activate()
End If
End sub

'subForm1
Private subForm1_Load(...)
Me.ControlBox = False
Me.WindowState = FormWindowState.Maximized
Me.StartPosition = FormStartPosition.Manual
End Sub

'subForm
Private subForm2_Load(...)
Me.ControlBox = False
Me.WindowState = FormWindowState.Maximized
Me.StartPosition = FormStartPosition.Manual
End Sub

**************************************************************************
 
Back
Top