当前位置:文档之家› VB做一个简单的图片浏览器,谁有代码

VB做一个简单的图片浏览器,谁有代码

VB做一个简单的图片浏览器,谁有代码?
怎么用VB做一个图片浏览器?
要求做到可以打开图片文件,
可以浏览下一张图片,上一张图片,
可以放大和缩小图片,
最难的是做简略图。

哪个高手有相关代码啊!?
有多少发多少啊!谢谢了。

我是VB新手啊!不太会,呵呵。

大家多多帮助啊!
最佳答案
我只会做到下面的代码了.其中:
Dir1-目录列表控件
Drive1-驱动器列表控件
File1-文件列表控件
Image1-图像控件
Text1-文本框控件
Option1-单选控件(Caption为"通过单击浏览")
Option2-单选控件(Caption为"通过双击浏览")
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error GoTo DriErr
Dir1.Path = Drive1.Drive
Exit Sub
DriErr:
If Err.Number = 68 Then
If MsgBox("请问要重试还是取消?", vbRetryCancel + vbCritical, "硬盘不存在或光驱没有插入磁盘!") = vbRetry Then
Resume 0
Else
Drive1.Drive = "C:"
Resume Next
End If
End If
End Sub
Private Sub File1_Click()
If Option2.Value = True Then Exit Sub
Dim picFile As String
If Right(Dir1.Path, 1) = "\" Then
picFile = Dir1.Path + File1.FileName Else
picFile = Dir1.Path + "\" + File1.FileName End If
Image1.Picture = LoadPicture(picFile)
Text1.Text = picFile
End Sub
Private Sub File1_DblClick()
If Option1.Value = True Then Exit Sub
Dim picFile As String
If Right(Dir1.Path, 1) = "\" Then
picFile = Dir1.Path + File1.FileName Else
picFile = Dir1.Path + "\" + File1.FileName End If
Image1.Picture = LoadPicture(picFile)
Text1.Text = picFile
End Sub。

相关主题