VB6.0中如何使用一个命令按钮每单击一次图片更换一张自定义路径的图片? 5
2个回答
展开全部
呵呵,也可以设置3个图片框,分别在两个图片框里面放上图片(两个可见(picture1和picture2),一个不可见(picture3)),当单击命令按钮的时候便触发图片交替,实现图片变换
private sub command 1 ()
picture3.picture = picture1.picture
picture1.picture = picture2.picture
picture2.picture = picture3.picture
end sub
private sub command 1 ()
picture3.picture = picture1.picture
picture1.picture = picture2.picture
picture2.picture = picture3.picture
end sub
展开全部
看了前面的答复感觉是不好使的,没有弄明白过程和变量的作用域和变量生存期的问题。不可能实现持续循环交替变换。试着用一下程序代码:
Static Sub anniu()
Dim x As Boolean
If x = False Then
Command1.Picture = LoadPicture("X:\vb\开.bmp")
x = True
Else
command1.Picture = LoadPicture("X:\vb\关.bmp")
x = False
End If
End Sub
--------------------------------------------------------------------------
Private Sub command1_Click()
Call anniu
End Sub
Static Sub anniu()
Dim x As Boolean
If x = False Then
Command1.Picture = LoadPicture("X:\vb\开.bmp")
x = True
Else
command1.Picture = LoadPicture("X:\vb\关.bmp")
x = False
End If
End Sub
--------------------------------------------------------------------------
Private Sub command1_Click()
Call anniu
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询