VB6.0中如何使用一个命令按钮每单击一次图片更换一张自定义路径的图片?

2024-12-19 15:13:17
推荐回答(2个)
回答1:

呵呵,也可以设置3个图片框,分别在两个图片框里面放上图片(两个可见(picture1和picture2),一个不可见(picture3)),当单击命令按钮的时候便触发图片交替,实现图片变换

private sub command 1 ()
picture3.picture = picture1.picture
picture1.picture = picture2.picture
picture2.picture = picture3.picture
end sub

回答2:

看了前面的答复感觉是不好使的,没有弄明白过程和变量的作用域和变量生存期的问题。不可能实现持续循环交替变换。试着用一下程序代码:
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