VB移动picturebox中的图片
我想按住鼠标右键不动,实时移动鼠标,松开就停下,请给出源代码我才刚入门,请说清楚一点,谢谢实时移动图片,松开就停下一楼,不对啊,我是想像PHOTOSHOP里那样,手形工具...
我想按住鼠标右键不动,实时移动鼠标,松开就停下,
请给出源代码
我才刚入门,请说清楚一点,谢谢
实时移动图片,松开就停下
一楼,不对啊,我是想像PHOTOSHOP里那样,手形工具,可以移动图片……
NO,不是左上角啊,是我点中哪里,哪里就跟着我的鼠标走 展开
请给出源代码
我才刚入门,请说清楚一点,谢谢
实时移动图片,松开就停下
一楼,不对啊,我是想像PHOTOSHOP里那样,手形工具,可以移动图片……
NO,不是左上角啊,是我点中哪里,哪里就跟着我的鼠标走 展开
2个回答
展开全部
'不知是否符合条件了...
Private Const IDC_HAND As Long = 32649&
Private Declare Function LoadCursorA Lib "user32" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
Private hHandCur As Long
Private Sub Form_Load()
hHandCur = LoadCursorA(0&, IDC_HAND)
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
SetCursor hHandCur
If Button = 2 Then '按鼠标右键(一般按左键比较习惯吧。左键是button=1)
Picture1.Left = Picture1.Left + X
Picture1.Top = Picture1.Top + Y
End If
End Sub
Private Const IDC_HAND As Long = 32649&
Private Declare Function LoadCursorA Lib "user32" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
Private hHandCur As Long
Private Sub Form_Load()
hHandCur = LoadCursorA(0&, IDC_HAND)
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
SetCursor hHandCur
If Button = 2 Then '按鼠标右键(一般按左键比较习惯吧。左键是button=1)
Picture1.Left = Picture1.Left + X
Picture1.Top = Picture1.Top + Y
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询