Private Sub ShowFilesInFolder()
Dim file As String
Dim FI As FileInfo
Dim PBox As PictureBox, Img As Image
Dim Left As Integer = ThumbnailPadding
Dim Top As Integer = ThumbnailPadding
Dim ThispBox As Control
Dim ThumbWidth As Integer = 90 ''antes era 90
Dim ThumbHeight As Integer = 120 ''antes era 120
If PictureBox1.Controls.Count > 0 Then Exit Sub
Me.Invalidate()
'For Each file In Directory.GetFiles(DirListBox1.Path)
Try
FI = New FileInfo("c:\sagmasoft\fotos\pintores\" + CStr(Pint.CodigoPintor) + ".jpg")
Catch err As Exception
FI = New FileInfo("c:\sagmasoft\fotos\pintores\555.png")
End Try
If FI.Extension = ".gif" Or FI.Extension = ".jpg" Or _
FI.Extension = ".bmp" Then
PBox = New PictureBox
'PBox.BorderStyle = BorderStyle.FixedSingle
PBox.SizeMode = PictureBoxSizeMode.CenterImage
If FI.Extension <> ".cdr" Then
Try
Img = Image.FromFile(FI.FullName)
Catch err As Exception
Img = Image.FromFile("c:\sagmasoft\fotos\pintores\555.png")
End Try
End If
If Left > PictureBox1.Width - PictureBox1.Left + ThumbnailPadding + ThumbWidth Then
Left = ThumbnailPadding
Top = Top + 10 '' antes era 80, ubicacion de la parte de arriba
End If
With PBox
.Left = Left
.Top = Top
.Width = 120 'Ubicacion del ancho hacia la derecha de la foto
.Height = 120 'Ubicacion de la foto en la parte superior TOP
.Image = CalculateThumbnailSize(Img, PBox.Width, PBox.Height)
.Visible = True
.Tag = FI.FullName
PictureBox1.Controls.Add(PBox)
AddHandler PBox.Click, New System.EventHandler(AddressOf OpenImage)
Left = Left + 124 '' antes era 74
End With
End If
End Sub