假设2个窗体 Form1,Form2(子窗体);在Form1点击按钮后显示Form2,Form2中代码如下
Option Explicit
Const Hwndx = -1
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) As Long
Dim myval As Long
Private Sub Form_Load()
myval = SetWindowPos(Me.hWnd, -1, 0, 0, 0, 0, 3)
End Sub
Option Explicit
Const Hwndx = -1
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) As Long
Dim myval As Long
Private Sub Form_Load()
myval = SetWindowPos(Me.hWnd, -1, 0, 0, 0, 0, 3)
End Sub