Gambas France BETA


Pas de compte ? Incription

ScollBar

À propos de ce code

Démonstration de l'utilisation de ScrollBar
Traduction en français et italien
Un programme du site allemand : https://gambas-buch.de/dwen/doku.php?id=k17:k17.14:start

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

PUBLIC SUB _new()

scbColorRed.MinValue = 0
scbColorRed.MaxValue = 255
scbColorRed.PageStep = 10
scbColorRed.Step = 1
scbColorRed.Value = 127

scbColorGreen.MinValue = 0
scbColorGreen.MaxValue = 255
scbColorGreen.PageStep = 10
scbColorGreen.Step = 1
scbColorGreen.Value = 127

scbColorBlue.MinValue = 0
scbColorBlue.MaxValue = 255
scbColorBlue.PageStep = 10
scbColorBlue.Step = 1
scbColorBlue.Value = 127

END ' _new()

PUBLIC SUB Form_Open()

FMain.Center
FMain.Resizable = FALSE
txbColorHex.MaxLength = 6
RGB_Change()

END ' Form_Open()

PUBLIC SUB RGB_Change()

SetPanelColor()
SetRGBLabel()
txbColorHex.Text = Hex$(Color.RGB(scbColorRed.Value, scbColorGreen.Value, scbColorBlue.Value), 6)

END ' RGB_Change()

PUBLIC SUB txbColorHex_Activate()

TRY panColor.Background = Val("&H" & txbColorHex.Text & "&")
IF ERROR THEN
panColor.Background = Color.Red
txbColorHex.Text = Hex$(Color.Red, 6)
SetRGB(panColor.Background)
ELSE
SetRGB(panColor.Background)
ENDIF ' ERROR ?

END ' txbColorHex_Activate()

PUBLIC SUB SetPanelColor()

panColor.Background = Color.RGB(scbColorRed.Value, scbColorGreen.Value, scbColorBlue.Value)
panColor.Refresh
WAIT

END ' SetPanelColor()

PRIVATE SUB SetRGB(iColor AS INTEGER)

Object.Lock(scbColorRed)
scbColorRed.Value = Color[iColor].Red
Object.Unlock(scbColorRed)
Object.Lock(scbColorGreen)
scbColorGreen.Value = Color[iColor].Green
Object.Unlock(scbColorGreen)
Object.Lock(scbColorBlue)
scbColorBlue.Value = Color[iColor].Blue
Object.Unlock(scbColorBlue)
SetRGBLabel()

END ' SetRGB(aColor As Integer)

PUBLIC SUB SetRGBLabel()

lblValueRed.Text = Str(scbColorRed.Value)
lblValueGreen.Text = Str(scbColorGreen.Value)
lblValueBlue.Text = Str(scbColorBlue.Value)

END ' SetRGBLabel()

PUBLIC SUB btnClose_Click()

FMain.Close

END ' btnClose_Click()

Commentaires