可以设置w为form.zorder(0),即最前面 或者用api函数setWindowPos使窗体在最前面 Public Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (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 LongFunction StayOnTop(Form As Form) 'EX: Call StayOnTop(Me) Dim lFlags As Long Dim lStay As LonglFlags = SWP_NOSIZE Or SWP_NOMOVE lStay = SetWindowPos(Form.hWnd, HWND_TOPMOST, 0, 0, 0, 0, lFlags) End Function
或者用api函数setWindowPos使窗体在最前面
Public Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (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 LongFunction StayOnTop(Form As Form) 'EX: Call StayOnTop(Me)
Dim lFlags As Long
Dim lStay As LonglFlags = SWP_NOSIZE Or SWP_NOMOVE
lStay = SetWindowPos(Form.hWnd, HWND_TOPMOST, 0, 0, 0, 0, lFlags)
End Function
这样,FORM4就总在FORM1之上了
然后你用两次就可以达到你要的效果了
吗?还不如用Mdi。VB 好像不行的,如有研究成果,请告之
[email protected]