HOWTO: Center a Form in the Windows CE Toolkit for VB5ID: Q187687
|
This article describes how to center a form in the Windows CE Toolkit for Visual Basic 5.0 (VBCE).
To center a form in VBCE 5.0, use the Move method of the Form to reposition it
on the screen.
The following example shows how to create a reusable routine that can be
used to center any form in your project:
Public Sub CenterForm(Frm)
'Do not try to use 'me' for the form reference (Frm).
On Error Resume Next
'Do not resize if Minimized or Maximized.
If Frm.WindowState = 0 Then
Frm.Move (Screen.Width - Frm.Width) \ 2, _
(Screen.Height - Frm.Height) \ 2, _
Frm.Width, Frm.Height
End If
End Sub
Private Sub Form_Load()
CenterForm Form1
End Sub
Additional query words: vbce wce vbce5
Keywords : kbToolkit kbVBp500 kbWinCE100 kbGrpVB
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: May 24, 1999