Hi,
I have some code which places all images from a folder on a form. I use a
File List-box, an Imagebox and an array. The code is working perfectly. See
the Form_Load-part.
Now we come to the problem (better my problem). I need some code for the
Image1_MouseDown-event. What code do I need to display the name of the
picture which I click?
See code below.
Thanks,
Sjoerd
' ## ---------------------------------------
Option Explicit
Private Sub Form_Load()
Dim yPos As Single
Dim xPos As Single
Dim i As Long
Me.Show
File1.Visible = False
File1.Pattern = "*.jpg;*.gif"
File1.Path = "f:\music\data\covers\"
'Set some rules for the array.
With Image1(0)
.Left = 0
.Top = 0
.Stretch = True
.Width = Me.ScaleWidth / Sqr(File1.ListCount * 1.5)
.Height = Me.ScaleHeight / Sqr(File1.ListCount * 1.5)
End With
Me.Tag = "Found " & File1.ListCount & " pictures.."
For i = 0 To File1.ListCount - 1
Me.Caption = Me.Tag & "Loading #" & i
DoEvents
If i > 0 Then ' we must load the new image box.
Load Image1(i)
'determine if it fits on the same row, if not, move the row down
If (Image1(i - 1).Left + (Image1(0).Width * 2)) > Me.Width Then
yPos = yPos + Image1(0).Height
xPos = 0
Else
xPos = xPos + Image1(0).Width
End If
End If
' load the picture
Image1(i).Picture = LoadPicture(File1.Path & _
IIf(Right$(File1.Path, 1) = "\", "", "\") & File1.List(i))
Image1(i).Visible = True ' After all is done show it
Image1(i).Move xPos, yPos ' now we can move it.
Next
End Sub
' ## ---------------------------------------
' ## ---------------------------------------
Private Sub Image1_MouseDown(Index As Integer, Button As Integer, _
Shift As Integer, X As Single, Y As Single)
MsgBox <WHAT DO I FILL IN HERE?>
End Sub
' ## ---------------------------------------
|