
How to center MDI child form
Quote:
> Is it possible to center the MDI form inside the MDI parent ?
Try this:
Sub CenterForm (frm As Form)
Dim iTop As Integer, iLeft As Integer
If frm.WindowState <> NORMAL Then Exit Sub
If ShowStatusBar Then 'allow for a status bar. Forms(0) is the parent
iTop = (Screen.Height - frm.Height - Forms(0)!StatusBar.Height) \ 2
iLeft = (Screen.Width - frm.Width) \ 2
Else
iTop = (Screen.Height - frm.Height) \ 2 'just use these if you dont
iLeft = (Screen.Width - frm.Width) \ 2 'have a status bar
End If
frm.Move iLeft, iTop
End Sub
MW