Link to home
Start Free TrialLog in
Avatar of MICS
MICS

asked on

make MDI Child 100% of height ot Parnet window

Of i have a MDI Parent form and a MDI child.   I want the mdi child to be 100% of the visible height Parent.

Meaning if i resize the MAIn parent form, the child will shrick to fill the inside.

any ideas
Avatar of cbueno
cbueno

HI
Make sure the child form properties BorderStyle is
2-Sizeable have and make sure its WindowState is 2-Maximized and MDIChild is set to True
In the Main parent form Resize event, put the following code.
Private Sub MDIForm_Resize()
Dim frm As Form
 For Each frm In Forms
  If frm.Name <> Me.Name Then
   frm.WindowState = vbMaximized
  End If
 Next
End Sub
use the scalewidth and scaleheight properties of the MDI Form.

' in the child form
Private Sub Form_LOad()
    Me.Move 0, 0, MDIParent.ScaleWidth, MDIParent.ScaleHeight
End Sub

Good Luck!
actuall also add the line....
Me.Windowstate = vbNormal
ASKER CERTIFIED SOLUTION
Avatar of supunr
supunr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MICS

ASKER

Hmm I tried the supunr last comment, and its making the MDI Child to High.

I have a MDI Form with menus and the i load a form that i want to dock to the left and always be the full height, never bigger.

thanks
Private Sub MDIForm_Resize()

Dim frm As Form
For Each frm In Forms
  If frm.Name <> Me.Name Then
   If frm.MDIChild = True Then
    frm.WindowState = vbMaximized
   End If
  End If
 
Next

End Sub
Avatar of MICS

ASKER

as stated in my original post I need height.

I dont want the width.

Dim frm As Form

Dim frmActive As Form
Set frmActive = ActiveForm

For Each frm In Forms
  If frm.Name <> Me.Name Then
   If frm.MDIChild = True Then
    frm.WindowState = vbMaximized
   End If
  End If
Next
On Error Resume Next
'Keep the active Child Form on top
frmActive.ZOrder 0
Avatar of MICS

ASKER

this still doesn't solve it I want it to be full height an a width of 500

Dim frm As Form

Dim frmActive As Form
Set frmActive = ActiveForm
If Me.WindowState = vbNormal Or Me.WindowState = vbMaximized Then
For Each frm In Forms
  If frm.Name <> Me.Name Then
   If frm.MDIChild = True Then
    frm.Top = 0
     frm.Height = Me.Height - 735 'Increase that number to decrease the frm.height if you have a menu, a toolbar or a statusbar
   End If
  End If
Next
On Error Resume Next
frmActive.ZOrder 0
End If
Avatar of MICS

ASKER

still runs into problems when i shrick my Main form causeing the menu to be double rows. the number is then to high.


Is there not a way to read the inside size of a mdi form?
Avatar of MICS

ASKER

Hmm.  now it seems to work...  Sorry about that.

I only needed the MOVE line, but that worked.

Thanks everyone.