前端之家收集整理的这篇文章主要介绍了
vb 点击控件移动窗体,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
添加模块 代码如下:
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long,ByVal wMsg As Long,ByVal wParam As Long,lparam As Any) As Long
Public Declare Function ReleaseCapture Lib "user32" () As Long
Public Sub DoDrag(TheForm As Form)
If TheForm.WindowState <> vbMaximized Then
ReleaseCapture
SendMessage TheForm.hwnd,&HA1,2,0&
End If
End Sub
在该控件的方法调用:
Private Sub Label1_MouseDown(Button As Integer,Shift As Integer,X As Single,Y As Single)
DoDrag Me
End Sub
原文链接:/vb/260359.html