Bonjour,
Je suis en train de vous mitonnez (il n'y a pas d'autres mots) un petit programme pour montrer des manipulations sur ce composant.
J'avais déjà posé une question à propos de la sauvegarde
J'aurais pu rester sur quelque chose de basique mais maintenant que j'ai mis le doigt dedans cela m'a pris tout le bras ! (surtout la partie colorisation )
Une petite image ?
Comme vous le constatez, il est possible de changer la couleur de remplissage et de contour, et même d'utiliser les dégradés ce qui m'amène à ma question :
pour le dégradé de type linéaire pas de soucis la rotation se gère facilement (enfin à partir du moment où l'on sait comment calculer les positions de début et de fin, mais ça, je le garde sous le coude pour un nouveau tutoriel) pour de dégradé radial par contre
Tout d'abord je n'arrive pas à m'y faire c'est ces fameux X, Y des positions rassurez-moi X est bien l'axe horizontal et Y le vertical ?
Second point j'ai beau changer les positions de la rotation (via ce code)
La rotation semble toujours être identique pour moi j'ai l'impression qu'il s'agit qu'elle s'applique à partir du coin haut gauche à moins qu'il y ait un re-calcul à faire ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
105 procedure TMainForm.PositionRotationChange(Sender: TObject); begin case PositionRotation.ItemIndex of 0 : begin // coin haut gauche if Objet.ItemIndex=0 then begin memPG.Fill.Gradient.RadialTransform.RotationCenter.X:=0; memPG.Fill.Gradient.RadialTransform.RotationCenter.Y:=0; end else begin memPG.Stroke.Gradient.RadialTransform.RotationCenter.X:=0; memPG.Stroke.Gradient.RadialTransform.RotationCenter.Y:=0; end; end; 1 : begin // haut centre if Objet.ItemIndex=0 then begin memPG.Fill.Gradient.RadialTransform.RotationCenter.X:=0.5; memPG.Fill.Gradient.RadialTransform.RotationCenter.Y:=0; end else begin memPG.Stroke.Gradient.RadialTransform.RotationCenter.X:=0.5; memPG.Stroke.Gradient.RadialTransform.RotationCenter.Y:=0; end; end; 2 : begin // coin haut droit if Objet.ItemIndex=0 then begin memPG.Fill.Gradient.RadialTransform.RotationCenter.X:=1; memPG.Fill.Gradient.RadialTransform.RotationCenter.Y:=0; end else begin memPG.Stroke.Gradient.RadialTransform.RotationCenter.X:=1; memPG.Stroke.Gradient.RadialTransform.RotationCenter.Y:=0; end; end; 3 : begin // Bord gauche centre if Objet.ItemIndex=0 then begin memPG.Fill.Gradient.RadialTransform.RotationCenter.X:=0; memPG.Fill.Gradient.RadialTransform.RotationCenter.Y:=0.5; end else begin memPG.Stroke.Gradient.RadialTransform.RotationCenter.X:=0; memPG.Stroke.Gradient.RadialTransform.RotationCenter.Y:=0.5; end; end; 4 : begin // centre if Objet.ItemIndex=0 then begin memPG.Fill.Gradient.RadialTransform.RotationCenter.X:=0.5; memPG.Fill.Gradient.RadialTransform.RotationCenter.Y:=0.5; end else begin memPG.Stroke.Gradient.RadialTransform.RotationCenter.X:=0.5; memPG.Stroke.Gradient.RadialTransform.RotationCenter.Y:=0.5; end; end; 5 : begin // bord droit centre if Objet.ItemIndex=0 then begin memPG.Fill.Gradient.RadialTransform.RotationCenter.X:=1; memPG.Fill.Gradient.RadialTransform.RotationCenter.Y:=0.5; end else begin memPG.Stroke.Gradient.RadialTransform.RotationCenter.X:=1; memPG.Stroke.Gradient.RadialTransform.RotationCenter.Y:=0.5; end; end; 6 : begin // coin bas gauche if Objet.ItemIndex=0 then begin memPG.Fill.Gradient.RadialTransform.RotationCenter.X:=0; memPG.Fill.Gradient.RadialTransform.RotationCenter.Y:=1; end else begin memPG.Stroke.Gradient.RadialTransform.RotationCenter.X:=0; memPG.Stroke.Gradient.RadialTransform.RotationCenter.Y:=1; end; end; 7 : begin // bas centre if Objet.ItemIndex=0 then begin memPG.Fill.Gradient.RadialTransform.RotationCenter.X:=0.5; memPG.Fill.Gradient.RadialTransform.RotationCenter.Y:=1; end else begin memPG.Stroke.Gradient.RadialTransform.RotationCenter.X:=0.5; memPG.Stroke.Gradient.RadialTransform.RotationCenter.Y:=1; end; end; 8 : begin // coin bas droit if Objet.ItemIndex=0 then begin memPG.Fill.Gradient.RadialTransform.RotationCenter.X:=1; memPG.Fill.Gradient.RadialTransform.RotationCenter.Y:=1; end else begin memPG.Stroke.Gradient.RadialTransform.RotationCenter.X:=1; memPG.Stroke.Gradient.RadialTransform.RotationCenter.Y:=1; end; end; end; RotationDialChange(Sender); // memPG.<Fill ouStroke>.Gradient.RadialTransform.RotationAngle:= RotationDial.Value; end;
P.S. Oui, ce programme permet de charger un fichier SVG, enfin, des fichiers "simples" comme ceux téléchargeables sur http://materialdesignicons.com/
Partager