高手请教,要想每点击一次图片框就显示一张不同的图片,用vb怎么写?谢谢。
2个回答
展开全部
我来吧。 新建一个 file1, 和一个picture1
把要显示的图片都放在(d:\1)文件夹里
复制代码
Private Sub Form_Load()
File1.Path = "d:\1"
File1.Pattern = "*.jpg;*.png;*.gif"
if file1.listcount>0 then
Picture1.Picture = LoadPicture("d:\1\" & file1.list(0))
end if
End Sub
Private Sub Picture1_Click()
Dim a As Integer
Randomize
if file1.listcount>0 then
a = int(rnd*int(File1.ListCount - 1))
Picture1.Picture = LoadPicture("d:\1\" & file1.list(a))
end if
end Sub
把要显示的图片都放在(d:\1)文件夹里
复制代码
Private Sub Form_Load()
File1.Path = "d:\1"
File1.Pattern = "*.jpg;*.png;*.gif"
if file1.listcount>0 then
Picture1.Picture = LoadPicture("d:\1\" & file1.list(0))
end if
End Sub
Private Sub Picture1_Click()
Dim a As Integer
Randomize
if file1.listcount>0 then
a = int(rnd*int(File1.ListCount - 1))
Picture1.Picture = LoadPicture("d:\1\" & file1.list(a))
end if
end Sub
展开全部
在图片上加响应,或者把按钮设置成图片,然后就是load
Option Explicit
Dim i As Integer
Private Sub Form_Load()
i = 1
End Sub
Private Sub Picture1_Click()
Me.Picture1.Picture = LoadPicture("d:\My Documents\桌面壁纸\" & i & ".jpg")
i = i + 1
If i = 6 Then i = 1
End Sub
Option Explicit
Dim i As Integer
Private Sub Form_Load()
i = 1
End Sub
Private Sub Picture1_Click()
Me.Picture1.Picture = LoadPicture("d:\My Documents\桌面壁纸\" & i & ".jpg")
i = i + 1
If i = 6 Then i = 1
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询