Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making MDIChild forms fit in the work area

Status
Not open for further replies.

DaemonSaDiablo

IS-IT--Management
Aug 5, 2003
10
0
0
AU
Hi Everyone.

Playing with a new app, but having trouble resizing the two child forms.

I thought it was fairly straight forward, MDI Parent form, no toolbars, menu's or status bars, so used the code:

frmClient.Height = mdiMain.Height \ 2
frmNotes.Height = frmClient.Height
frmNotes.Top = frmClient.Height
frmNotes.Left = 0

But the two forms are slightly larger than half the parent. Any ideas?
 
well a msgbox will give u the answer.
try msgbox FormHeight & "-" & MDIHeight

but personally speaking what u have done is correct. but i want to add another code. now u have just two forms. therefore u will have no problem writing code for each and every form. but what if u have more than that? (i have a project that have 100 and above forms)...

Known is handfull, Unknown is worldfull
 
Hi:

Your code is not adjusting for the border width of the MDI form. Try this:
Code:
    sngBorderHeight = mdiMain.Height - mdiMain.ScaleHeight

    frmClient.Top = 0
    frmClient.Height = (mdiMain.Height - sngBorderHeight) \ 2
    frmClient.Left = 0

    frmNotes.Height = frmClient.Height
    frmNotes.Top = frmClient.Top+frmClientHeight
    frmNotes.Left = 0

Cassie
;-)
 
Thank you for the answers, but answered my own questions after taking a nap... I guess sleep is necessary sometimes :).

Made one very silly mistake - used height instead of scaleheight and width instead of scalewidth. After switching, worked just fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top