'///////////////////// Select the small photo ////////////////////
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
File1.Pattern = "*.jpg"
End Sub
'/////////// PUT FILE NAME INTO TEXT BOX
Private Sub File1_Click()
Dim txtPath$
txtPath$ = Dir1.Path
Dim Msg ' Declare variable.
If Mid(txtPath$, Len(txtPath$), 1) = "\" Then
txt_image.Text = Dir1.Path & File1.FileName
Else
txt_image.Text = File1.FileName
End If
Picture2.Picture = LoadPicture(Dir1.Path & "\" & File1.FileName)
End Sub
Private Sub Form_Load()
' Setup picture box
With Picture2
.AutoSize = True
.ZOrder 1
.Move 0, 0
End With
' Setup scroll bars
ArrangeScrollBars
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
' Adjust scroll bars to new form size
ArrangeScrollBars
End Sub
Private Sub ArrangeScrollBars()
' Resize scroll bars to fit form, and set their max value (in relation to form size)
With HScroll1
.Move 0, Picture1.ScaleHeight - .Height, Picture1.ScaleWidth - VScroll1.Width
.Max = IIf((Picture2.ScaleWidth - Picture1.Width + VScroll1.Width) > 0, _
Picture2.Width - Picture1.ScaleWidth + VScroll1.Width, 0)
.SmallChange = IIf(Int(.Max / 10) > 0, Int(.Max / 10), 1)
.LargeChange = IIf(Int(.Max / 5) > 0, Int(.Max / 5), 1)
End With
With VScroll1
.Move Picture1.ScaleWidth - .Width, 0, .Width, Picture1.ScaleHeight - HScroll1.Height
.Max = IIf((Picture2.Height - Picture1.ScaleHeight + HScroll1.Height) > 0, _
Picture2.Height - Picture1.ScaleHeight + HScroll1.Height, 0)
.SmallChange = IIf(Int(.Max / 10) > 0, Int(.Max / 10), 1)
.LargeChange = IIf(Int(.Max / 5) > 0, Int(.Max / 5), 1)
End With
End Sub
Private Sub HScroll1_Change()
Picture2.Move 0 - HScroll1.Value
End Sub
Private Sub HScroll1_Scroll()
Picture2.Move 0 - HScroll1.Value
End Sub
Private Sub VScroll1_Change()
Picture2.Move Picture2.Left, 0 - VScroll1.Value
End Sub
Private Sub VScroll1_Scroll()
Picture2.Move Picture2.Left, 0 - VScroll1.Value
End Sub