怎样用VB做一个图片浏览器?? 30
2个回答
展开全部
Public Class Form1
Dim i As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
i = i - 1
If (i < 0) Then
i = 4
End If
'pic.Image = imgl.Images(i)
pic.Image = Image.FromFile(imgNames(i).FullName)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
i = i + 1
If (i >= 4) Then
i = 0
End If
'pic.Image = imgl.Images(i)
pic.Image = Image.FromFile(imgNames(i).FullName)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If Button3.Text Is "播放" Then
Timer1.Start()
Button3.Text = "暂停"
Else
Timer1.Stop()
Button3.Text = "播放"悔高
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
i = i + 1
If (i >= 4) Then
i = 0
End If
'pic.Image = imgl.Images(i)
pic.Image = Image.FromFile(imgNames(i).FullName)
End Sub
Dim imgNames As IO.FileInfo()
Private Sub test2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim _Url As String
_Url = Application.StartupPath & "\Imager" '获取程序文件信息所在的文件夹
Dim _ImgUrl As New System.IO.DirectoryInfo(_Url) '新建文件夹对象
imgNames = _ImgUrl.GetFiles("*.jpg") '从文件信罩贺息中获取文件对象的类型
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
FolderBrowserDialog1.ShowDialog()
Dim _Url As String
_Url = FolderBrowserDialog1.SelectedPath
Dim _ImgUrl As New System.IO.DirectoryInfo(_Url) '新建文件物前派夹对象
imgNames = _ImgUrl.GetFiles("*.jpg") '从文件信息中获取文件对象的类型
End Sub
Dim form As New Form2
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles form2Click.Click
Form.Show() '*************显示窗体
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Me.Close()
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
form.Close()
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Dim clockF As New clock
clockF.ShowDialog()
End Sub
End Class
显示张数的用text显示出来就可以了
其实我也是初学者这些代码有些小BUG请包涵我会修改的
大家可以加个QQ交流交流
Dim i As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
i = i - 1
If (i < 0) Then
i = 4
End If
'pic.Image = imgl.Images(i)
pic.Image = Image.FromFile(imgNames(i).FullName)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
i = i + 1
If (i >= 4) Then
i = 0
End If
'pic.Image = imgl.Images(i)
pic.Image = Image.FromFile(imgNames(i).FullName)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If Button3.Text Is "播放" Then
Timer1.Start()
Button3.Text = "暂停"
Else
Timer1.Stop()
Button3.Text = "播放"悔高
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
i = i + 1
If (i >= 4) Then
i = 0
End If
'pic.Image = imgl.Images(i)
pic.Image = Image.FromFile(imgNames(i).FullName)
End Sub
Dim imgNames As IO.FileInfo()
Private Sub test2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim _Url As String
_Url = Application.StartupPath & "\Imager" '获取程序文件信息所在的文件夹
Dim _ImgUrl As New System.IO.DirectoryInfo(_Url) '新建文件夹对象
imgNames = _ImgUrl.GetFiles("*.jpg") '从文件信罩贺息中获取文件对象的类型
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
FolderBrowserDialog1.ShowDialog()
Dim _Url As String
_Url = FolderBrowserDialog1.SelectedPath
Dim _ImgUrl As New System.IO.DirectoryInfo(_Url) '新建文件物前派夹对象
imgNames = _ImgUrl.GetFiles("*.jpg") '从文件信息中获取文件对象的类型
End Sub
Dim form As New Form2
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles form2Click.Click
Form.Show() '*************显示窗体
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Me.Close()
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
form.Close()
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Dim clockF As New clock
clockF.ShowDialog()
End Sub
End Class
显示张数的用text显示出来就可以了
其实我也是初学者这些代码有些小BUG请包涵我会修改的
大家可以加个QQ交流交流
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |