求VB定时更换图片的代码
5秒更换一次,2次后回到初时图像,这样循环。(计时用timer)第一次更换:PictureBox20的图片改为C:\Picture1.jpg;form2背景图片改为C:\...
5秒更换一次,2次后回到初时图像,这样循环。(计时用timer)
第一次更换:PictureBox20的图片改为C:\Picture1.jpg;form2背景图片改为C:\Picture11.jpg
第二次更换:PictureBox20的图片改为C:\Picture2.jpg;form2的背景图片改为C:\Picture22.jpg
初时图像:C:\Picture0.jpg和C:\Picture00.jpg 展开
第一次更换:PictureBox20的图片改为C:\Picture1.jpg;form2背景图片改为C:\Picture11.jpg
第二次更换:PictureBox20的图片改为C:\Picture2.jpg;form2的背景图片改为C:\Picture22.jpg
初时图像:C:\Picture0.jpg和C:\Picture00.jpg 展开
展开全部
'这个方法可能比较麻烦,简单点的可以用资源文件然后从资源文件读取就行了.
Option Explicit
dim counter%
counter=0
Private Function A()
picturebox20.picture=loadpicutre("c:\picture1.jpg")
form2.picture=loadpicture("c:\picutre11.jpg")
End Function
Private Function B()
picturebox20.picture=loadpicutre("c:\picture2.jpg")
form2.picture=loadpicture("c:\picutre22.jpg")
End Function
Private Function C()
picturebox20.picture=loadpicutre("c:\picture0.jpg")
form2.picture=loadpicture("c:\picutre00.jpg")
End Function
Timer中的代码: 'timer的interval = 5000
counter=str(counter)+1
select case str(counter)
case 0
c
case 1
a
case 2
b
counter=0
end select
Option Explicit
dim counter%
counter=0
Private Function A()
picturebox20.picture=loadpicutre("c:\picture1.jpg")
form2.picture=loadpicture("c:\picutre11.jpg")
End Function
Private Function B()
picturebox20.picture=loadpicutre("c:\picture2.jpg")
form2.picture=loadpicture("c:\picutre22.jpg")
End Function
Private Function C()
picturebox20.picture=loadpicutre("c:\picture0.jpg")
form2.picture=loadpicture("c:\picutre00.jpg")
End Function
Timer中的代码: 'timer的interval = 5000
counter=str(counter)+1
select case str(counter)
case 0
c
case 1
a
case 2
b
counter=0
end select
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
展开全部
Option Explicit
Dim colPicture As New Collection
Dim colBackPicture As New Collection
Dim NowIndex As Integer
Private Sub Form_Load()
colPicture.Add "c:\picture0.jpg"
colPicture.Add "c:\picture1.jpg"
colPicture.Add "c:\picture2.jpg"
colBackPicture.Add "c:\picture00.jpg"
colBackPicture.Add "c:\picture11.jpg"
colBackPicture.Add "c:\picture22.jpg"
Me.Picture = LoadPicture(colBackPicture.Item(1))
PictureBox20.Picture = LoadPicture(colPicture.Item(1))
NowIndex = 1
End Sub
Private Sub Timer1_Timer()
NowIndex = NowIndex + 1
If NowIndex > 3 Then
NowIndex = 1
End If
Me.Picture = LoadPicture(colBackPicture.Item(NowIndex))
PictureBox20.Picture = LoadPicture(colPicture.Item(NowIndex))
End Sub
Dim colPicture As New Collection
Dim colBackPicture As New Collection
Dim NowIndex As Integer
Private Sub Form_Load()
colPicture.Add "c:\picture0.jpg"
colPicture.Add "c:\picture1.jpg"
colPicture.Add "c:\picture2.jpg"
colBackPicture.Add "c:\picture00.jpg"
colBackPicture.Add "c:\picture11.jpg"
colBackPicture.Add "c:\picture22.jpg"
Me.Picture = LoadPicture(colBackPicture.Item(1))
PictureBox20.Picture = LoadPicture(colPicture.Item(1))
NowIndex = 1
End Sub
Private Sub Timer1_Timer()
NowIndex = NowIndex + 1
If NowIndex > 3 Then
NowIndex = 1
End If
Me.Picture = LoadPicture(colBackPicture.Item(NowIndex))
PictureBox20.Picture = LoadPicture(colPicture.Item(NowIndex))
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询