vb当鼠标经过时图片变化
展开全部
移入 很好做 就是 mousemove 事件中添加代码
picture1.image=“路径 或者 image列表中的图片”
移出 稍微麻烦一点,我之前的做法是 添加一个定时器,10秒一判断,(时间可以自己定义)鼠标的位置,如果不在picture1上 就把图片更换回来!
还有一种方法,是在form的mousemove事件中 添加 更换图片的代码!
第一种 可能 比较占用资源,因为使用timer控件,要不停的做检测!
第二种 有个弊端就是form的mousemove事件可能会影响到 picture1的mousemove事件
picture1.image=“路径 或者 image列表中的图片”
移出 稍微麻烦一点,我之前的做法是 添加一个定时器,10秒一判断,(时间可以自己定义)鼠标的位置,如果不在picture1上 就把图片更换回来!
还有一种方法,是在form的mousemove事件中 添加 更换图片的代码!
第一种 可能 比较占用资源,因为使用timer控件,要不停的做检测!
第二种 有个弊端就是form的mousemove事件可能会影响到 picture1的mousemove事件
展开全部
用以下三个事件即可。
Private Sub Form_Load()
Picture1.Picture = LoadPicture("D:\My Documents\1.bmp")
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.Picture = LoadPicture("D:\My Documents\1.bmp")
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.Picture = LoadPicture("D:\My Documents\2.bmp")
End Sub
Private Sub Form_Load()
Picture1.Picture = LoadPicture("D:\My Documents\1.bmp")
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.Picture = LoadPicture("D:\My Documents\1.bmp")
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.Picture = LoadPicture("D:\My Documents\2.bmp")
End Sub
追问
你好,你的指向图片时更换是对的,但是移出时却不行,必须要移出窗体才能更换。
麻烦你检查下行吗。我是新手,还不会搞
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
创建两个image控件,image1为原图片,image2为鼠标指向时的图片
Private Sub Form_Load()
Picture1.Picture = Image1.Picture
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.Picture = Image1.Picture
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.Picture = Image2.Picture
End Sub
Private Sub Form_Load()
Picture1.Picture = Image1.Picture
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.Picture = Image1.Picture
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.Picture = Image2.Picture
End Sub
追问
不对吧,这个样子在上面的控件不就把下面的控件给遮住了吗?
追答
对了,两个image控件的visible都设为false
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询