VB编程 求教:我想用picture控件做个程序,当我单击picture时图片变换,代码是什么?
用image做的也可以。PrivateSubForm_Load()a="C:\DocumentsandSettings\Administrator\桌面\pic\1.jp...
用image做的也可以。
Private Sub Form_Load()
a = "C:\Documents and Settings\Administrator\桌面\pic\1.jpg"
b = "C:\Documents and Settings\Administrator\桌面\pic\2.jpg"
Image1.Picture = LoadPicture(a)
End Sub
Private Sub Image1_Click()
Image1.Picture = LoadPicture(b)
End Sub
我这样为什么不行啊?我一点图片就没了,而不是出现图片2。 展开
Private Sub Form_Load()
a = "C:\Documents and Settings\Administrator\桌面\pic\1.jpg"
b = "C:\Documents and Settings\Administrator\桌面\pic\2.jpg"
Image1.Picture = LoadPicture(a)
End Sub
Private Sub Image1_Click()
Image1.Picture = LoadPicture(b)
End Sub
我这样为什么不行啊?我一点图片就没了,而不是出现图片2。 展开
1个回答
展开全部
这需要提供你的完整路径的图片名,并且图片名是连续的
比如p1,p2,p3
dim a,b as string
a = "C:\Documents and Settings\Administrator\桌面\pic\1.jpg"
b = "C:\Documents and Settings\Administrator\桌面\pic\2.jpg"
Private Sub Form_Load()
Image1.Picture = LoadPicture(a)
End Sub
Private Sub Image1_Click()
Image1.Picture = LoadPicture(b)
End Sub
这样就应该没问题了
比如p1,p2,p3
dim a,b as string
a = "C:\Documents and Settings\Administrator\桌面\pic\1.jpg"
b = "C:\Documents and Settings\Administrator\桌面\pic\2.jpg"
Private Sub Form_Load()
Image1.Picture = LoadPicture(a)
End Sub
Private Sub Image1_Click()
Image1.Picture = LoadPicture(b)
End Sub
这样就应该没问题了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询