20/01/13 20:37
visualrenzo
ho scritto questo codice , voglio che quando premo i tasti del mouse succedano degli eventi, in questo caso venga caricata una foto.
Se non metto il call carica funziona sempre anche 1000 volte, nel momento in cui aggiungo la call ad esempio nel case 1 mi passa solo una volta e poi da qui il programma non ci passa più.
Dove sbaglio ?
'Tasti del mouse
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case Button
Case 1
Call Carica
'MsgBox "Pressed the LEFT key"
'Image1 = LoadPicture(App.Path & "\Testi\" & "26 gennaio 2013.JPG"
Case 2
MsgBox "Pressed the RIGHT key"
Case 4
MsgBox "Pressed the MIDDLE key"
End Select
End Sub
Private Sub Carica()
NomeDir = (App.Path & "\Testi\*.jpg"
' NomeDir = "C:\*.jpg"
Y = Dir(NomeDir)
indice = 0
X = InStrRev(NomeDir, "\", Len(NomeDir), vbTextCompare)
NomeDirP = Mid(NomeDir, 1, X)
Do Until Y = ""
Image1.Picture = LoadPicture(NomeDirP & Y)
indice = indice + 1
Y = Dir
Loop
End Sub
Se non metto il call carica funziona sempre anche 1000 volte, nel momento in cui aggiungo la call ad esempio nel case 1 mi passa solo una volta e poi da qui il programma non ci passa più.
Dove sbaglio ?
'Tasti del mouse
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case Button
Case 1
Call Carica
'MsgBox "Pressed the LEFT key"
'Image1 = LoadPicture(App.Path & "\Testi\" & "26 gennaio 2013.JPG"
Case 2
MsgBox "Pressed the RIGHT key"
Case 4
MsgBox "Pressed the MIDDLE key"
End Select
End Sub
Private Sub Carica()
NomeDir = (App.Path & "\Testi\*.jpg"
' NomeDir = "C:\*.jpg"
Y = Dir(NomeDir)
indice = 0
X = InStrRev(NomeDir, "\", Len(NomeDir), vbTextCompare)
NomeDirP = Mid(NomeDir, 1, X)
Do Until Y = ""
Image1.Picture = LoadPicture(NomeDirP & Y)
indice = indice + 1
Y = Dir
Loop
End Sub
aaa