by DmR (2 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 16th February 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
I've called this program "PictureViewer". It allowes to browse pictures that are placed on some chosen directory. Very useful for Digital
VERSION 5.00
Begin VB.Form Form1
Caption = "PictureViewer"
ClientHeight = 6045
ClientLeft = 2910
ClientTop = 2805
ClientWidth = 9120
LinkTopic = "Form1"
ScaleHeight = 6045
ScaleWidth = 9120
Begin VB.PictureBox picCont
BackColor = &H80000008&
Height = 5535
Left = 3420
ScaleHeight = 5475
ScaleWidth = 5535
TabIndex = 7
Top = 360
Width = 5595
Begin VB.Image imgPic
Height = 1875
Left = 420
Top = 1140
Width = 3795
End
End
Begin VB.FileListBox File1
Height = 3210
Left = 60
TabIndex = 2
Top = 2700
Width = 3195
End
Begin VB.DirListBox Dir1
Height = 1215
Left = 60
TabIndex = 1
Top = 1080
Width = 3195
End
Begin VB.DriveListBox Drive1
Height = 315
Left = 60
TabIndex = 0
Top = 360
Width = 3195
End
Begin VB.Label lblPicture
Caption = "Picture:"
Height = 195
Left = 3420
TabIndex = 6
Top = 120
Width = 615
End
Begin VB.Label lblFile
Caption = "File:"
Height = 195
Left = 60
TabIndex = 5
Top = 2460
Width = 915
End
Begin VB.Label lblPath
Caption = "Path:"
Height = 195
Left = 60
TabIndex = 4
Top = 840
Width = 915
End
Begin VB.Label lblDrive
Caption = "Drive:"
Height = 195
Left = 60
TabIndex = 3
Top = 120
Width = 915
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error GoTo Eh
Dir1.Path = Left$(Drive1.Drive, 1) & ":\"
Exit Sub
Eh:
If Err = 68 Then
ans = MsgBox("Device " & Drive1.Drive & " unavailable!" _
& vbCrLf & "Please check is there disk in this drive?", _
vbExclamation)
Else
Err.Raise Err.Number, Err.Source, Err.Description
End If
End Sub
Private Sub File1_Click()
Dim k As Double
FileName = File1.Path
If Right$(FileName, 1) <> "\" Then FileName = FileName & "\"
FileName = FileName & File1.FileName
imgPic.Stretch = False
imgPic.Picture = LoadPicture(FileName)
DrawAllStuff
End Sub
Private Sub Form_Load()
File1.Pattern = "*.bmp;*.jpeg;*.gif;*.jpg"
End Sub
Private Sub Form_Resize()
File1.Height = Form1.Height - 3150
picCont.Height = Form1.Height - 880
picCont.Width = Form1.Width - 3700
DrawAllStuff
End Sub
Public Sub DrawAllStuff()
If imgPic.Picture Is Nothing Then Exit Sub
If imgPic.Width = 0 Then Exit Sub
k = imgPic.Height / imgPic.Width
imgPic.Stretch = True
If k <= 1 Then
imgPic.Move 0, _
Abs(picCont.ScaleHeight - k * picCont.Width) / 2, _
picCont.Width, _
k * picCont.Width
Else
imgPic.Move Abs(picCont.ScaleWidth - picCont.Height / k) / 2, _
0, _
picCont.Height / k, _
picCont.Height
End If
End Sub
No comments have been posted about I've called this program PictureViewer. It allowes to browse pictures that are placed on some cho. Why not be the first to post a comment about I've called this program PictureViewer. It allowes to browse pictures that are placed on some cho.