VB line控件的移动
程序在运行时(用VB生成的exe文件);如何能用鼠标拖动line控件的位置;方便的话;最好给段代码...
程序在运行时(用VB生成的exe文件);如何能用鼠标拖动line控件的位置;方便的话;最好给段代码
展开
1个回答
2013-07-31
展开全部
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
移动line 很难实现 因为line控件没有事件(mouse move ,mouse down) 这个是移动textbox 的代码 你可以尝试去改改
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
移动line 很难实现 因为line控件没有事件(mouse move ,mouse down) 这个是移动textbox 的代码 你可以尝试去改改
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询