最近在自学vb,用的是visual studio community 2013里带的visual basic 2013
想让一个图片随鼠标移动,大概操作是这样的:
新建一个form,加了一个picturebox1、然后载入了一张图片
代码是这样的
Public Class GameWindow
Private Sub form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
picturebox1.Left = Y
picturebox1.Top = X
End Sub
End Class
但是试了一下发现图片不会随鼠标动,请问是什么原因呢?
多谢!
【新手】关于vb的mousemove
答案:2 悬赏:80 手机版
解决时间 2021-03-06 02:03
- 提问者网友:棒棒糖
- 2021-03-05 13:18
最佳答案
- 五星知识达人网友:雾月
- 2021-03-05 14:03
Public Class GameWindow
Private Sub form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
picturebox1.Left = x
picturebox1.Top = y
End Sub
End Class
left是水平方向,y是垂直方向
Private Sub form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
picturebox1.Left = x
picturebox1.Top = y
End Sub
End Class
left是水平方向,y是垂直方向
全部回答
- 1楼网友:三千妖杀
- 2021-03-05 15:09
代码其实很简单,看起来不太对,但楼主调试一下就知道了:
private sub form_mousemove(button as integer, shift as integer, x as single, y as single)
text1 = ""
end sub
private sub text1_mousemove(button as integer, shift as integer, x as single, y as single)
text1 = "好好学习"
end sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯