|Subject:||MDI - How to handle|
|Posted by:||Darkman (Darkm…@discussions.microsoft.com)|
|Date:||Sun, 10 Aug 2008|
I am having trouble finding any info on handling multiple MDI Child forms.
Basically I have three child forms.
The first form is a title display. It sits as 0,0. It needs to automatically
resize Width only when the MDI Parent resizes. It is a fixed Height (50).
The second form is like a menu control with a bunch of buttons. It sits as
0,50. It needs to automatically resize Height only when the MDI Parent
resizes. It is a fixed Width (100).
The last form is a data display. Depending on what data is selected from the
second form this form will change (i.e. For Data Selection 1 frmData1 will
display, for Selection 2 frmData2 will display). It sits as 100,50. It needs
to automatically resize Height & Width when the MDI Parent resizes.
I can't seem to get the 3 forms to resize when the MDI Parent resizes.
Also even though I set the size of the forms (Height + Width) based apon the
MDI Parent form size, the child forms are always bigger than the MDI Parent
display window (i.e. Scroll bars appear).
Any help would be greatly appreciated.
Below is the code I use to open the Child forms initially.
frmTop.MdiParent = frmMain
frmTop.StartPosition = FormStartPosition.Manual
frmTop.Top = 0
frmTop.Left = 0
frmLeft.MdiParent = frmMain
frmLeft.StartPosition = FormStartPosition.Manual
frmLeft.Top = frmTop.Bottom
frmLeft.Left = 0
frmData1.MdiParent = frmMain
frmData1.StartPosition = FormStartPosition.Manual
frmData1.Top = frmTop.Bottom
frmData1.Left = frmLeft.Width
Dim lngH As Long, lngW As Long
lngH = frmMain.Height
lngW = frmMain.Width
frmTop.Height = 50
frmTop.Width = lngW
frmLeft.Width = 100
frmLeft.Height = lngH
frmData1.Width = lngW - frmLeft.Width
frmData1.Height = lngH - frmTop.Height