1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
| ' Gambas class file
PUBLIC sPhotoPath AS STRING PUBLIC siPhotos AS SHORT PUBLIC siIndice AS SHORT PUBLIC sPhotoList AS NEW String[]
PUBLIC SUB DirChooser1_Change()
DIM sPhotos AS String[] = [".jpeg", ".jpg", ".gif", ".png"] ' photos autorisées DIM sDir AS String[] = Dir(DirChooser1.SelectedPath).Sort() 'Get a list of all the files in the selected folder and sort them DIM siLoop, siPhoto AS SHORT 'Loop variables
siPhotos = 0 'Reset this global variable sPhotoList.Clear '<-------------------------------------------------------- effacement de la liste des photos sPhotoPath = DirChooser1.SelectedPath '<----------------------------------- répertoire choisi des photos
FOR siLoop = 0 TO sDir.Max 'Loop through all the files in the selected folder FOR siPhoto = 0 TO sPhotos.Max 'Loop through the permissable extensions IF LCase(sDir[siLoop]) ENDS sPhotos[siPhoto] THEN sPhotoList.Add(sDir[siLoop]) 'If the file ends with the permissible extension then add it to sPhotoList array NEXT NEXT WAIT
INC Application.Busy '<----------------------------------------------------- curseur d'attente IF sPhotoList.Max <> -1 THEN 'si la liste sPhotoList n'est pas vide siPhotos = sPhotoList.Max 'Set siPhotos to sPhotoList.Max PictureBox1.Picture = Picture[sPhotoPath &/ sPhotoList[0]] '<----------- affichage première photo du répertoire ELSE PictureBox1.Picture = NULL WAIT END IF
IF sPhotoList.Max > 1 THEN pnlNavigation.Visible = TRUE ELSE pnlNavigation.Visible = FALSE '<-- panneau de navigation visible ou non DEC Application.Busy '<----------------------------------------------------- fin cureseur d'attente
END
PUBLIC SUB Form_Open()
DIM sChemPict AS STRING
sChemPict = Desktop.GetDirectory("PICTURES") 'découverte du dossier photos DirChooser1.SelectedPath = Settings["PhotoPath", sChemPict] 'sauvegarde du chemin des photos sPhotoPath = DirChooser1.SelectedPath 'sPhotoPath = the selected path Settings.Save '<------------------------------------------------- enregistrement des settings Panel1.Settings = [35, 75] '<------------------------------------- réglage du panneau Settings.Read(ME) '<---------------------------------------------- récupération des settings de fermeture
END
PUBLIC SUB DirChooser1_Activate()
DirChooser1_Change()
END
PUBLIC SUB tbSuivante_Click()
IF siIndice < siPhotos THEN siIndice += 1 PictureBox1.Picture = NULL WAIT PictureBox1.Picture = Picture[sPhotoPath &/ sPhotoList[siIndice]] ENDIF
END
PUBLIC SUB tbPrecedente_Click()
IF siIndice > 0 THEN siIndice -= 1 PictureBox1.Picture = NULL WAIT PictureBox1.Picture = Picture[sPhotoPath &/ sPhotoList[siIndice]] ENDIF
END
PUBLIC SUB tbDiaporama_Click()
DIM i AS INTEGER
FOR i = 0 TO siPhotos IF tbDiaporama.Value = TRUE THEN PictureBox1.Picture = NULL WAIT PictureBox1.Picture = Picture[sPhotoPath &/ sPhotoList[i]] WAIT 1 ELSE PictureBox1.Picture = NULL WAIT PictureBox1.Picture = Picture[sPhotoPath &/ sPhotoList[0]] '<-------- première photo BREAK '<---------------------------------------------------- sortie de la boucle si arrêt diaporama ENDIF NEXT
END
PUBLIC SUB Form_Close()
Settings.Write(ME)
END
|