===
''' SDI Example
''' Place in Forms's Form_Resize () or Form_Load() Event
'Centers Form (if not minimized or maximized.)
If WindowState = 0 Then
Move (Screen.Width - Screen.ActiveForm.Width) / 2, (Screen.Height - Screen.ActiveForm.Height) / 2
End If
===
''' SDI (Using Sub)
'''Usage: sCenterForm Me
Sub sCenterForm (mForm As Form)
Dim mTop As Integer, mLeft As Integer
If mForm.WindowState <> 0 Then Exit Sub
mTop = (Screen.Height - mForm.Height) \ 2
mLeft = (Screen.Width - mForm.Width) \ 2
mForm.Move mLeft, mTop
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.