用image控件,失去焦点后这个功能怎么写?

guojimilan0561 2007-12-07 03:01:00
用image控件,起始的时候是一个图片,然后移到控件上(MouseMove事件)时切换另一张图片,然后又移开
失去焦点后我想把image控件的图片又回到最开始的默认图片,这个怎么写???
...全文
44 点赞 收藏 5
写回复
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
tzwsoho 2007-12-07
用上api releasecapture和setcapture效果更好,百度搜索“鼠标离开”N多代码
回复
东方之珠 2007-12-07
哦,对不起! image1.picture要用LoadPicture装入图片。
回复
东方之珠 2007-12-07
private sub form_load()
image1.picture="c:\1.bmp" '启动时装入一张图片1
end sub


Private Sub image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
image1.picture="c:\2.bmp" '鼠标移到上面变成图片2
end sub


Private Sub image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
if Button=1 then image1.picture="c:\3.bmp" '鼠标按下变成图片3
end sub


Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
image1.picture="c:\1.bmp" '鼠标移开还原图片1
end sub


回复
VBToy 2007-12-07
Option Explicit
Dim picA As Boolean
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If picA = True Then
Image1.Picture = LoadPicture("d:\b.jpg")
picA = Not picA
End If
End Sub



Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If picA = False Then
Image1.Picture = LoadPicture("d:\a.jpg")
picA = Not picA
End If
End Sub
回复
sqkzhh 2007-12-07
用LoadPicture函数加载默认图片路径应该行
回复
发动态
发帖子
VB基础类
创建于2007-09-28

7451

社区成员

VB 基础类
申请成为版主
社区公告
暂无公告