飞机票余票查询:vb程序算法

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/27 05:02:02
利用Visual Basic编写一个图片查看器程序(仿ACDSEE软件的图片浏览器程序)。
① 可以打开并浏览选定磁盘上的选定文件夹中的图片文件
② 可以浏览指定文件夹下的所有图片文件
③ 可以对正在浏览的图片进行放大缩小

Option Explicit

Private Sub Command1_Click()
Picture2.Picture = Image1.Picture
End Sub

Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub

Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
Image1.Picture = LoadPicture("")
Picture2.Picture = LoadPicture("")
End Sub

Private Sub File1_Click()
Dim f As String
If Right(File1.Path, 1) = "\" Then
f = File1.Path & File1.FileName
Else
f = File1.Path & "\" & File1.FileName
End If
Image1.Picture = LoadPicture(f)
If Picture2.Width > Picture1.Width Then
HScroll1.Enabled = True
HScroll1.Min = 0
HScroll1.Max = Picture1.Width - Picture2.Width
Else
HScroll1.Enabled = False
End If
If Picture2.Height > Picture1.Height Then
VScroll1.Enabled = True
VScroll1.Min = 0
VScroll1.Max = Picture1.Height - Picture1.Height
Else
VScroll1.Enabled = False
End If
End Sub

Private Sub Form_Load()
File1.Pattern = "*.bmp;*.gif"
End Sub

Private Sub HScroll1_Change()
HScroll1.Max = Picture1.Width - Picture2.Width
End Sub
参考一下 ,我也没做全的