?
Solved

make MDI Child 100% of height ot Parnet window

Posted on 2003-03-05
13
Medium Priority
?
278 Views
Last Modified: 2010-04-07
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
0
Comment
Question by:MICS
[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
  • 5
  • 4
  • 3
  • +1
13 Comments
 

Expert Comment

by:cbueno
ID: 8074533
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
0
 
LVL 3

Expert Comment

by:DocM
ID: 8074599
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
0
 
LVL 11

Expert Comment

by:supunr
ID: 8075834
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!
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Expert Comment

by:supunr
ID: 8075841
actuall also add the line....
Me.Windowstate = vbNormal
0
 
LVL 11

Accepted Solution

by:
supunr earned 200 total points
ID: 8075875
actaully, I interpreted your question wrong, here is the code you probably want.

In the parent's resize event, put this comment

Private Sub MDIParent_Resize()
     Dim frmToResize As Form

     ' do not resize or move windows if moved
     if (WindowState = vbMinimized) then Exit Sub

     ' Otherwise move all windows that are not aleardy
     ' maximized and are resizable
     For Each frmToResize In Forms
          If frmToResize.Name <> Me.Name Then  ' not this form
               if (frmToResize.WindowState = vbNormal AND _
                    frmToResize.BorderStyle = vbSizable) then
                    frmToResize.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
               End If
          End If
     Next
End Sub

Good Luck!
0
 

Author Comment

by:MICS
ID: 8081444
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
0
 
LVL 3

Expert Comment

by:DocM
ID: 8081939
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
0
 

Author Comment

by:MICS
ID: 8082205
as stated in my original post I need height.

I dont want the width.
0
 
LVL 3

Expert Comment

by:DocM
ID: 8082313

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
0
 

Author Comment

by:MICS
ID: 8082545
this still doesn't solve it I want it to be full height an a width of 500
0
 
LVL 3

Expert Comment

by:DocM
ID: 8083040

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
0
 

Author Comment

by:MICS
ID: 8083390
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?
0
 

Author Comment

by:MICS
ID: 8083444
Hmm.  now it seems to work...  Sorry about that.

I only needed the MOVE line, but that worked.

Thanks everyone.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month9 days, 23 hours left to enroll

762 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