Gambas France BETA


Pas de compte ? Incription

[GB3]Les TAGs comme Liste de Données.[GB3]

À propos de ce code

Dans cette petite Application, j'utilise,
le TAG des CONTROLs, comme Liste de Données!
Ça peut donner des Idées...
Cliquer sur les BUTTONs, pour sortir une série.

Reivillo.

Code source

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
' Gambas class file

PUBLIC iTab AS NEW INTEGER[51]
PUBLIC hLbl AS NEW Label[7]
PUBLIC sNbr AS NEW STRING[7]
PUBLIC sTag AS String[]

PUBLIC SUB Form_Open()

DIM iFor AS INTEGER = 0

ME.Center
ME.Y = 0
FOR iFor = 0 TO 6 ' Création des 7 Label, par défaut.
hLbl[iFor] = NEW Label(Panel2)
WITH hLbl[iFor]
.W = 28
.H = 42
.Font = Font["Monospace,Bold,12"]
.Foreground = Color.Red
.Alignment = Align.Center
END WITH
NEXT
Loto.Tag = "49,5,10,1,/loto.png" ' Liste des Données,
EuroMillions.Tag = "50,5,11,2,/euromillions.png" ' dans les Tags.
RANDOMIZE

END

PUBLIC SUB Select_Game_MouseDown() ' Début du Tirage.

DIM iWhl, iFor, iRnd AS INTEGER = 0
DIM iCnt AS INTEGER = 0

IF (LAST.Tag = "") OR (ME.Tag = 1) THEN RETURN
ME.Tag = 1
sTag = Split(LAST.Tag, ",") ' Extraction des Données dans les Tags.
WHILE iWhl <= 2 ' Différencie le Tirage Principal du ( Complémentaire ou Étoiles. )
FOR iFor = 1 TO sTag[0 + iWhl] ' Chargement du Tableau.
iTab[iFor] = iFor
NEXT
FOR iFor = 1 TO sTag[1 + iWhl]
iRnd = Int(Rnd(sTag[0 + iWhl])) + 1 ' Sortie Pseudo-Aléatoire, d'un Élément.
sNbr[iCnt] = iTab[iRnd] ' Mémorise le Contenu, de l'Élément sorti.
INC iCnt
SWAP iTab[sTag[0 + iWhl]], iTab[iRnd] ' Echange le Contenu de l'Élement sorti, avec le Contenu du dernier Élément.
DEC sTag[0 + iWhl] ' Réduction du Tableau,( Cache le dernier Élément, et donc impossible de ressortir le même Contenu. )
NEXT
iWhl += 2
WEND
PicShow.Picture = Picture[Application.Path & sTag[4]] ' Début de l'Affichage.
Panel2.W = PicShow.W
Panel2.X = (ME.W - Panel2.W) / 2
FOR iFor = 0 TO 6
hLbl[iFor].Text = "" ' Vidage, des 7 Label.
NEXT
FOR iFor = 0 TO 4 ' Affichage des Sorties ( Principales [5]. )
WAIT 1
WITH hLbl[iFor]
TRY .X = (PicShow.X + 1) + (iFor * 33)
IF ERROR THEN QUIT
.Y = PicShow.Y
.Text = sNbr[iFor]
END WITH
NEXT
SELECT LAST.Text ' Affichage des Sorties ( Complémentaire [1] ou Étoiles [2]. )
CASE "Loto"
WITH hLbl[5]
WAIT 1
.X = hLbl[4].X + 66
.Y = PicShow.Y
.Font = Font["Monospace,Bold,12"]
.Text = sNbr[5]
END WITH
CASE "EuroMillions"
WITH hLbl[5]
WAIT 1
.X = hLbl[4].X + 71
.Y = hLbl[4].Y + 4
.Font = Font["Monospace,Bold,10"]
.Text = sNbr[5]
END WITH
WITH hLbl[6]
WAIT 1
.X = hLbl[5].X + 46
.Y = hLbl[5].Y
.Font = hLbl[5].Font
.Text = sNbr[6]
END WITH
END SELECT
ME.Tag = FALSE

END

PUBLIC SUB MeClose_MouseDown()

ME.close

END

Commentaires