1个回答
展开全部
Option Explicit
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_SYSCOMMAND = &H112
Private Const SC_MOVE = &HF010&
Private Const HTCAPTIO = 2
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture 'WM_SYS向窗体发送一个移动窗体命令
Call SendMessage(Me.hWnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTIO, 0) 'SC_MOVE+ HTCAPTIO表示单击左键移动窗体
End Sub
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_SYSCOMMAND = &H112
Private Const SC_MOVE = &HF010&
Private Const HTCAPTIO = 2
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture 'WM_SYS向窗体发送一个移动窗体命令
Call SendMessage(Me.hWnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTIO, 0) 'SC_MOVE+ HTCAPTIO表示单击左键移动窗体
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询