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 Private Const HWND_TOPMOST = -1 Private Const HWND_NOTOPMOST = -2 Private Function PositionForm(ByVal Form As Form, Optional PrePlan As Boolean = True) As Long Dim lgConst As Long If PrePlan Then lgConst = HWND_TOPMOST Else lgConst = HWND_NOTOPMOST End If PositionForm = SetWindowPos(Form.hwnd, lgConst, _ Form.Left \ Screen.TwipsPerPixelX, _ Form.Top \ Screen.TwipsPerPixelY, _ Form.Width \ Screen.TwipsPerPixelX, _ Form.Height \ Screen.TwipsPerPixelY, 0) End Function Private Sub Command1_Click() If Check1.Value = vbChecked Then 'Si la CheckBox est Cochée, on met : PositionForm Form1 'Pour mettre une Form au premier plan: Else 'Sinon, PositionForm Form1, False 'Pour qu'elle soit normal: End If End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question