Gambas France BETA


Pas de compte ? Incription

TextLabel :

Exemple d'utilisation de TextLabel :



Un petit programme italien, anonyme : Switch_Toggle_Led



Le code :



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

PRIVATE im AS Image
PRIVATE led AS Image
PRIVATE ms AS SHORT

PUBLIC SUB Form_Open()

ME.Center

im = Image.Load("switch_toggle.png")

WITH PictureBox1
.W = im.W
.H = im.H / 2
END WITH

WITH TextLabel1
.X = PictureBox1.X
.Y = PictureBox1.Y + PictureBox1.H
.W = im.W
END WITH

led = Image.Load("led.png")

WITH PictureBox2
.W = led.W
.H = led.H / 2
END WITH

Mostra(1)

END

PUBLIC SUB PictureBox1_MouseWheel()

Mostra(Mouse.Delta)

END

PUBLIC SUB PictureBox1_MouseMove()

IF Mouse.Y > ms THEN
Mostra(-1)
ELSE
Mostra(1)
ENDIF

ms = Mouse.Y

END

PRIVATE PROCEDURE Mostra(c AS SHORT)

DIM mn AS Image
DIM d AS BYTE = 1

SELECT c
CASE 1
TextLabel1.Text = "Off"
CASE -1
TextLabel1.Text = "On"
d = 2
END SELECT

mn = im.Copy(0, im.H - (im.H / d), im.W, im.H / 2)

PictureBox1.Picture = mn.Picture

mn = led.Copy(0, led.H - (led.H / d), led.W, led.H / 2)

PictureBox2.Picture = mn.Picture

END


====================

Navigation :



<-- Liens du Wiki : <--
<-- Accueil du WIKI : <--
<-- Contrôle par Contrôle <--

====================

Documentation :



==============================