vb study
پنج شنبه 30 دی 1389, 19:46 عصر
با سلام خدمت تمامی دوستان
برای جابجایی عکس بویسله دکمه چپ ماوس من از کد زیر استفاده می کردم اما الان نیاز دارم که با دکمه میانی ماوس این کار رو انجام بدم به همین دلیل در کد زیر به جای vbLeftButton عبارت vbMiddleButton را نوشتم ولی برنامه عمل نمیکنه مشکل کار کجاست؟ :متفکر:
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
Public Sub ObjectMove(obj As Object)
On Error Resume Next
Call ReleaseCapture
SendMessage obj.hwnd, &HA1, 2, 0&
End Sub
Private Sub Picture2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
ObjectMove Picture2
End If
End Sub
برای جابجایی عکس بویسله دکمه چپ ماوس من از کد زیر استفاده می کردم اما الان نیاز دارم که با دکمه میانی ماوس این کار رو انجام بدم به همین دلیل در کد زیر به جای vbLeftButton عبارت vbMiddleButton را نوشتم ولی برنامه عمل نمیکنه مشکل کار کجاست؟ :متفکر:
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
Public Sub ObjectMove(obj As Object)
On Error Resume Next
Call ReleaseCapture
SendMessage obj.hwnd, &HA1, 2, 0&
End Sub
Private Sub Picture2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
ObjectMove Picture2
End If
End Sub