VB在image中随机出现图片怎么写
1个回答
展开全部
先在C盘创建一个文件夹,名为IMAGE,在里面放N张图片就好
打开VB
在窗体上加一个IMAGE,和FILE
控件,COMMAND1
控件
代码
Private
Sub
Command1_Click()
Dim
i
As
Integer
For
i
=
0
To
File1.ListCount
-
1
File1.ListIndex
=
i
*
Rnd
Next
i
Image1.Picture
=
LoadPicture(File1.Path
&
"\"
&
File1.FileName)
End
Sub
Private
Sub
Form_Load()
File1.Path
=
"C:\image\"
File1.ListIndex
=
0
Image1.Picture
=
LoadPicture(File1.Path
&
"\"
&
File1.FileName)
End
Sub
打开VB
在窗体上加一个IMAGE,和FILE
控件,COMMAND1
控件
代码
Private
Sub
Command1_Click()
Dim
i
As
Integer
For
i
=
0
To
File1.ListCount
-
1
File1.ListIndex
=
i
*
Rnd
Next
i
Image1.Picture
=
LoadPicture(File1.Path
&
"\"
&
File1.FileName)
End
Sub
Private
Sub
Form_Load()
File1.Path
=
"C:\image\"
File1.ListIndex
=
0
Image1.Picture
=
LoadPicture(File1.Path
&
"\"
&
File1.FileName)
End
Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询