Option Explicit Private Declare Function SetWindowPos& Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) Private Sub Form_Load()Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2 'centre the form on the screen SetWindowPos OnTop.hwnd, -1, 0, 0, 0, 0, 3End Sub
Private Declare Function SetWindowPos& Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Sub Form_Load()Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2 'centre the form on the screen SetWindowPos OnTop.hwnd, -1, 0, 0, 0, 0, 3End Sub
如果是,在显示form2时:
form2.show 0,form1