用vb.net如何编写图片浏览器的基本步骤功能是:图片的打开、显示、缩放、旋转 。窗体上放一个PictureBoxvb.net图片浏览器,两个CommandButton,一个FileListBox
Private Sub Command1_Click()
If File1.ListIndex = 0 Then
ShowPic File1.ListCount - 1
Else
ShowPic File1.ListIndex - 1
End If
End Sub
Private Sub Command2_Click()
If File1.ListIndex = File1.ListCount - 1 Then
ShowPic 0
Else
ShowPic File1.ListIndex + 1
End If
End Sub
Private Sub Form_Load()
File1.Visible = False
File1.Pattern = "*.jpg;*.gif" '可以浏览的文件类型 , 使用分号隔开
File1.Path = App.Path '改成你需要浏览的目录,比如"C:\Pic"
If File1.ListCount1 Then '目录中图片在两张以上可以浏览
ShowPic 0
Exit Sub
ElseIf File1.ListCount = 1 Then '目录中只有一张图片时只显示这一张
ShowPic 0
End If
Command1.Enabled = False
Command2.Enabled = False
End Sub
Private Sub ShowPic(Index As Long)
File1.ListIndex = Index
Picture1.Picture = LoadPicture(File1.Path"\"File1.List(Index))
End Sub
如果对您有帮助,请记得采纳为满意答案,谢谢vb.net图片浏览器!祝您生活愉快!
vaela
我要做一个用vb编写的图片浏览器 , 怎样使用定时器控件使其每间隔1000毫秒 , 就自动显示下一张图片???vb.net图片浏览器我的是VS2010的VB.Netvb.net图片浏览器,已经调试通过 。
组成vb.net图片浏览器:一个窗体、一个PictureBox控件、一个ListBox控件、一个Timer控件
作用:把vb.net图片浏览器我的文档中图片文档的所有jpe和gif图片加载到ListBox控件中,然后Timer控件就每隔一秒读取ListBox中的图片路径文件名列表显示到PictureBox上 。
代码:
Public Class Form1
Dim PicIndex As Long
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.ListBox1.Items.Clear()
Me.PictureBox1.ImageLocation = ""
For Each foundImage As String In _
My.Computer.FileSystem.GetFiles( _
My.Computer.FileSystem.SpecialDirectories.MyPictures, _
FileIO.SearchOption.SearchTopLevelOnly, "*.gif*", "*.jpg*")
Me.ListBox1.Items.Add(foundImage)
Next
If Me.ListBox1.Items.Count1 Then
MsgBox("There are no JPEG or GIF images in" _
" the Picture folder.")
End If
Me.PictureBox1.SizeMode = PictureBoxSizeMode.Zoom
Timer1.Enabled = True
Timer1.Interval = 1000
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Me.PictureBox1.ImageLocation = Me.ListBox1.SelectedItem
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If ListBox1.Items.Count1 Then Exit Sub
If PicIndexListBox1.Items.Count Then
Me.PictureBox1.ImageLocation = ListBox1.Items(PicIndex)
Me.Text = "当前图片路径和文件名: "ListBox1.Items(PicIndex)
PicIndex = PicIndex + 1
Else
PicIndex = 0
End If
End Sub
End Class
在vb.net下怎么制作一个图片浏览器,根据用户选择的文件夹,程序自动搜索改文件夹下的图片文件 。Public Class Form1
Private TPS As Integer
Private TPPath() As String '定义不确定元素个数组,及动态数组
Private Sub LoadPhoto()
'将图片路径及图片名加载到数组
Dim JS As Integer '计数用
For Each foundFile As String In My.Computer.FileSystem.GetFiles(CurDir()"\职员图片")
TPS = TPS + 1 '将图片数存入变量中
Next
ReDim TPPath(TPS - 1) '确定数组大小
For Each FoundFile As String In My.Computer.FileSystem.GetFiles(CurDir()"\职员图片")
'将图片路径存入数组
TPPath(JS) = FoundFile
JS = JS + 1
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LoadPhoto()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = TPPath.Length '获取数组大小
Label1.Text = TPPath(1) '获取数组中第2个元素的值
End Sub
vb.net编写一个照片浏览器程序 , 程序执行时单击下一张,将会显示下一张照片我说选把打开多个图片路径加载到一个listbox里 , 利用listbox写代码
Private Sub picbox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
If ListBox1.SelectedIndex = count Then
Try
ListBox1.SelectedIndex = ListBox1.SelectedIndex + 1
Catch
ListBox1.SelectedIndex = 0
End Try
End If
picbox.Image = ListBox1.SelectedItem.ToString
End Sub
怎样用vb.net做一个图片浏览器?在自定义工具箱中选择dirlistboxvb.net图片浏览器,drivelistbox , filelistbox,添加这3个控件,然后在窗体上添加这些控件和一个picturebox控件,代码如下vb.net图片浏览器:
Public Class Form1
Private Sub DirListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DirListBox1.SelectedIndexChanged
FileListBox1.Path = DirListBox1.Path
End Sub
Private Sub DriveListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DriveListBox1.SelectedIndexChanged
DirListBox1.Path = DriveListBox1.Drive
End Sub
Private Sub FileListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles FileListBox1.SelectedIndexChanged
PictureBox1.Image = Image.FromFile(FileListBox1.Path + "\" + FileListBox1.SelectedItem.ToString())
End Sub
End Class
vb.net图片浏览器你可以自己在修改下,这只是个模型,呵呵vb.net图片浏览器!
【vb.net图片浏览器 vb打开图片】vb.net图片浏览器的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vb打开图片、vb.net图片浏览器的信息别忘了在本站进行查找喔 。
推荐阅读
- 恋爱游戏上映时间在哪看,恋爱游戏百度百科
- vb删除html代码,vb清除form内容
- mysql怎么查平均值 mysql 查询平均值
- c语言函数有哪些重点 c语言函数重点知识
- oracle存储过程名字,oracle存储过程名字长度
- word怎么分类,word怎么分类求和
- python爬虫要用什么软件,python爬虫用什么工具
- 山地赛车游戏大全视频免费,山地赛车比赛视频
- 快手直播发的真爱红包,快手上主播发的红包