le = True
Pr.Value = 0
Pr.Max = filHidden.ListCount
Pr.Min = 0
//启动进度条
Com(0).Picture = LoadPicture
Com(0).Visible = False
If Com.Count > 1 Then
For i = 1 To Com.Count - 1
Unload Com(i)
Next
End If
$$AGESEP$$
//初始化缩略图载体com
On Error Resume Next
file://忽略错误
file://lFilCnt = filHidden.ListCount
For lIdx = 0 To filHidden.ListCount - 1
Load Com(lIdx)
Com(lIdx).Caption = filHidden.List(lIdx)
Com(lIdx).Visible = True
Pr.Value = 1
Next lIdx
//创建所需要的所有缩略图载体
file://载体的个数等于选定目录下图片文件个数
Call Form_Resize
//对载体进行排序
DoEvents
For lIdx = 0 To filHidden.ListCount - 1
picLoad.Picture = LoadPicture()
picThumb.Cls
picLoad.Picture = LoadPicture(Apath & filHidden.List(lIdx))
StretchBlt picThumb.hdc, 0, 0, picThumb.Width, picThumb.Height,picLoad.hdc, 0, 0, _ picLoad.ScaleWidth, picLoad.ScaleHeight, vbSrcCopy
Set Com(lIdx).Picture = picThumb.Image
//按顺序为载体添加缩略图片
DoEvents
Pr.Value = lIdx + 1
Next lIdx
Set picLoad.Picture = LoadPicture()
Set picThumb.Picture = LoadPicture()
Pr.Visible = False
Screen.MousePointer = 0
//释放占用的资源、隐藏进度条、恢复鼠标指针
End Sub
.
Private Sub filHidden_PathChange()
$$AGESEP$$
//当文件目录改变时计算出标准的目录变量
file://显示有关的目录和图片文件个数信息
file://调用缩略图创建过程函数
//
CreateThumbs
End Sub
Private Sub Form_Resize()
file://本函数用来对
程序界面控件位置进行相应的调整
file://并且调整缩略图的位置
Dim X As Long
Dim Y As Long
Dim lIdx As Long
Dim lCols As Long
If Me.WindowState <> vbMinimized Then
If Me.Width < 600 * Screen.TwipsPerPixelX Then
Me.Width = 600 * Screen.TwipsPerPixelX
ElseIf Me.Height < 378 * Screen.TwipsPerPixelY Then
Me.Height = 378 * Screen.TwipsPerPixelY
end if
//限定软件界面的最小宽度和高度
Else
picFrame.Move 2, Command1.Height, Me.ScaleWidth - 11, Me.ScaleHeight - Command1.Height - St.Height
vsbSlide.Move picFrame.ScaleWidth - vsbSlide.Width, 0, vsbSlide.Width, picFrame.ScaleHeight
lCols = Int((picFrame.ScaleWidth - vsbSlide.Width) / Com(0).Width)
For lIdx = 0 To Com.Count - 1
X = (lIdx Mod lCols) * Com(0).Width
Y = Int(lIdx / lCols) * Com(0).Height
Com(lIdx).Move X, Y
Next lIdx
picSlide.Width = lCols * Com(0).Width
picSlide.Height = Int(Com.Count /lCols)*Com(0).Height
If Int(Com.Count / lCols) < (Com.Count / lCols) Then
picSlide.Height = picSlide.Height + Com(0).Height
End If
vsbSlide.Value = 0
vsbSlide.Max = picSlide.Height - picFrame.ScaleHeight
If vsbSlide.Max < 0 Then
vsbSlide.Max = 0
vsbSlide.Enabled = False
Else
vsbSlide.Enabled = True
vsbSlide.SmallChange = Com(0).Height
vsbSlide.LargeChange = picFrame.ScaleHeight
End If
End If
Pr.Top = St.Top + 8
Pr.Left = St.Panels(4).Left + 6
Picture1.Move (picFrame.Width - Picture1.Width) / 2, (picFrame.Height - Picture1.Height) / 2
End Sub
..
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
$$AGESEP$$
file://如果被全屏浏览的图片较大时
file://可以用鼠标拖动图片来浏览全貌
ReleaseCapture
SendMessage Picture1.hwnd, WM_SYSCOMMAND, SC_MOVE, 0
End Sub
.
Private Sub vsbSlide_Change()
//当缩略图较多时可以移动滑块进行浏览
picSlide.Top