vb中,如何在运行时用鼠标对控件(如Textbox)进行移动和缩放(即改变大小)操作?

 我来答
匿名用户
2013-10-18
展开全部
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
Const WM_SYSCOMMAND = &H112
Const SC_MOVE = &HF010&
Const HTCAPTION = 2
Private Sub MoveWindow(ByVal hwnd As Long)

Dim ret As Long

ReleaseCapture

ret = SendMessage(Text1.hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0)
End Sub
Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
MoveWindow hwnd
End Sub

Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MoveWindow hwnd
End Sub
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式