Bonjour,
Quelqu'un à déjà essayer de griser les fenêtres en arrière plan ? J'aimerai assombrir les fenêtres qui sont en arrière plan afin de ne pas surcharger mon application avec des fenêtres superposé.
Merchiche
Bonjour,
Quelqu'un à déjà essayer de griser les fenêtres en arrière plan ? J'aimerai assombrir les fenêtres qui sont en arrière plan afin de ne pas surcharger mon application avec des fenêtres superposé.
Merchiche
Salut,
J'avais prévu de faire paraitre sur les sources de developpez.com une unité avec des fonctions qui permettent justement de griser une fenêtre. Je profite donc de ce message pour diffuser les sources ici, et je pense qu'il serait bien que les modos diffuse ça dans la partie sources Delphi du site.
J'en profite également pour remercier sub0 qui m'a permis grace à ces différentes réponses dans des posts à m'aider a réaliser cette fonction (Rendont à césar ce qui est à césar, une grande partie du mérite de cette fonction lui revient ).
voici donc le source de l'unité :
en fait, au lieu d'appeller un showmodal d'une autre fenêtre il suffit d'appeller la fonction CustomShowModal en lui passant en paramètre la fenêtre que vous souhaitez afficher en showmodal. Et automatiquement la fonction grisera la fenêtre active (Donc celle qui appelle le showmodal) et affichera l'autre fenêtre. il est clair qu'en terme d'ergonomie c'est bien plus pratique pour l'utilisateur.
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134 {*------------------------------------------------------------------------------ Unité permettant de griser une form lorsqu'elle appelle un showmodal pour en afficher une autre @Author tiki06 @Version 02-août-2006 Version initiale -------------------------------------------------------------------------------} Unit UGriserForm; Interface Uses Windows, Forms, Types, Graphics; const PIXELCOUNTMAX = 32768; WS_EX_LAYERED = $80000; type pRGBArray = ^TRGBArray; TRGBArray = ARRAY[0..PIXELCOUNTMAX-1] OF TRGBTriple; Procedure FusionerImage(FusionForm: TForm; BmpGrise: TBitmap); Function CustomShowModal(Fenetre: TForm):integer; implementation {*------------------------------------------------------------------------------ Fonction pour fusioner la form et l'image grisé @param FusionForm Form a fusioner @param BmpGrise Bitmap de l'image grisé -------------------------------------------------------------------------------} Procedure FusionerImage(FusionForm: TForm; BmpGrise: TBitmap); Var Size : PSIZE; TopLeft, BmpTopLeft : TPoint; Blend : TBlendFunction; Begin With FusionForm Do Begin SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) Or WS_EX_LAYERED); New(Size); Size.cx := Width; Size.cy := Height; TopLeft := BoundsRect.TopLeft; BmpTopLeft := Point(0, 0); With Blend Do Begin BlendOp := 0; BlendFlags := 0; SourceConstantAlpha := 255; AlphaFormat := 0; End; BmpGrise.PixelFormat := pf32bit; UpdateLayeredWindow(Handle, GetDC(0), @TopLeft, Size, BmpGrise.Canvas.handle, @BmpTopLeft, 0, @Blend, 2); End; End; {*---------------------------------------------------------------------------- Fonction pour afficher une fenêtre en showmodal et griser celle qui est active pendant l'appel du showmodal @param Fenetre Form a afficher en Showmodal -----------------------------------------------------------------------------} Function CustomShowModal(Fenetre: TForm):integer; var WindowHandle : THandle; deviceContext : HDC; BitmapForm : Tbitmap; icolor : integer; r,g,b:byte; iheight,iwidth : integer; RowOriginal : pRGBArray; FormGrise : TForm; begin WindowHandle:= Screen.ActiveForm.Handle; deviceContext:= GetWindowDC(WindowHandle); try BitmapForm := Tbitmap.Create; BitmapForm.PixelFormat := pf24bit; BitmapForm.Width := Screen.ActiveForm.Width; BitmapForm.Height := Screen.ActiveForm.Height; BitBlt(BitmapForm.Canvas.Handle, 0, 0, BitmapForm.Width, BitmapForm.Height, deviceContext, 0, 0, SRCCOPY); finally ReleaseDC(WindowHandle, deviceContext); end; for iHeight := 0 to BitmapForm.height-1 do begin RowOriginal := pRGBArray(BitmapForm.Scanline[iHeight]); for iWidth := 0 to BitmapForm.width-1 do begin r:=RowOriginal[iWidth].rgbtRed; g:=RowOriginal[iWidth].rgbtGreen; b:=RowOriginal[iWidth].rgbtBlue; icolor:=(r+g+b) div 3; RowOriginal[iWidth].rgbtRed := icolor; RowOriginal[iWidth].rgbtGreen := icolor; RowOriginal[iWidth].rgbtBlue := icolor; end; end; FormGrise := Tform.Create(Screen.ActiveForm); FormGrise.Name := 'GrayscaleForm'; FormGrise.Left := Screen.ActiveForm.Left; FormGrise.Top := Screen.ActiveForm.Top; FormGrise.Width := Screen.ActiveForm.Width; FormGrise.Height := Screen.ActiveForm.Height; FormGrise.DoubleBuffered := True; FormGrise.BorderIcons := Screen.ActiveForm.BorderIcons; FormGrise.BorderStyle := Screen.ActiveForm.BorderStyle; FormGrise.Show; FusionerImage(FormGrise,BitmapForm); FormGrise.BringToFront; BitmapForm.Free; Result:=Fenetre.ShowModal; if FormGrise<>nil then FormGrise.Release; end; End.
Si vous avez des questions n'hésitez pas.
Chouette, j'ai bien fait de poser la question dans le forum DELPHI. Le petit hic, est que je développe en C++ Builder, et je n'ai jamais fait de pascal. Bon, je vais essayer de transposer tout ça. Quand c'est oki, je fais signe, et je diffuserai le source sur le forum de c++ sans oublier les remerciments à césar... je suis impatient de tester tout ça.
... Ca ne va pas être facile..........
Alors pourquoi poster sur le forum DelphiEnvoyé par kurkaine
Modérateur Delphi
Le guide du bon forumeur :
- Les règles du forum tu liras
- La FAQ et les tutoriels tu consulteras
- La fonction Recherche tu utiliseras
- Google tu vénèreras
__________
Rayek World : Youtube Facebook
j'ai bien tester ton code sa marche tres bien j uste que y a le caption de la form en arriere plan qui change le temps d'une fraction de second (assez long pour etre remarquer essai de voir si en peut pas améliorer sa)
j'ai fait une petit modification.
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134 {*------------------------------------------------------------------------------ Unité permettant de griser une form lorsqu'elle appelle un showmodal pour en afficher une autre @Author tiki06 @Version 02-août-2006 Version initiale -------------------------------------------------------------------------------} Unit UGriserForm; Interface Uses Windows, Forms, Types, Graphics; const PIXELCOUNTMAX = 32768; WS_EX_LAYERED = $80000; type pRGBArray = ^TRGBArray; TRGBArray = ARRAY[0..PIXELCOUNTMAX-1] OF TRGBTriple; Procedure FusionerImage(FusionForm: TForm; BmpGrise: TBitmap); Function CustomShowModal(Fenetre: TForm):integer; implementation {*------------------------------------------------------------------------------ Fonction pour fusioner la form et l'image grisé @param FusionForm Form a fusioner @param BmpGrise Bitmap de l'image grisé -------------------------------------------------------------------------------} Procedure FusionerImage(FusionForm: TForm; BmpGrise: TBitmap); Var Size : PSIZE; TopLeft, BmpTopLeft : TPoint; Blend : TBlendFunction; Begin With FusionForm Do Begin SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) Or WS_EX_LAYERED); New(Size); Size.cx := Width; Size.cy := Height; TopLeft := BoundsRect.TopLeft; BmpTopLeft := Point(0, 0); With Blend Do Begin BlendOp := 0; BlendFlags := 0; SourceConstantAlpha := 255; AlphaFormat := 0; End; BmpGrise.PixelFormat := pf32bit; UpdateLayeredWindow(Handle, GetDC(0), @TopLeft, Size, BmpGrise.Canvas.handle, @BmpTopLeft, 0, @Blend, 2); End; End; {*---------------------------------------------------------------------------- Fonction pour afficher une fenêtre en showmodal et griser celle qui est active pendant l'appel du showmodal @param Fenetre Form a afficher en Showmodal -----------------------------------------------------------------------------} Function CustomShowModal(Fenetre: TForm):integer; var WindowHandle : THandle; deviceContext : HDC; BitmapForm : Tbitmap; icolor : integer; r,g,b:byte; iheight,iwidth : integer; RowOriginal : pRGBArray; FormGrise : TForm; begin WindowHandle:= Screen.ActiveForm.Handle; deviceContext:= GetWindowDC(WindowHandle); try BitmapForm := Tbitmap.Create; BitmapForm.PixelFormat := pf24bit; BitmapForm.Width := Screen.ActiveForm.Width; BitmapForm.Height := Screen.ActiveForm.Height; BitBlt(BitmapForm.Canvas.Handle, 0, 0, BitmapForm.Width, BitmapForm.Height, deviceContext, 0, 0, SRCCOPY); finally ReleaseDC(WindowHandle, deviceContext); end; for iHeight := 0 to BitmapForm.height-1 do begin RowOriginal := pRGBArray(BitmapForm.Scanline[iHeight]); for iWidth := 0 to BitmapForm.width-1 do begin r:=RowOriginal[iWidth].rgbtRed; g:=RowOriginal[iWidth].rgbtGreen; b:=RowOriginal[iWidth].rgbtBlue; icolor:=(r+g+b) div 3; RowOriginal[iWidth].rgbtRed := icolor; RowOriginal[iWidth].rgbtGreen := icolor; RowOriginal[iWidth].rgbtBlue := icolor; end; end; FormGrise := Tform.Create(Screen.ActiveForm); FormGrise.Name := Screen.ActiveForm.Caption; <- j'ai rajouter sa ********** FormGrise.Left := Screen.ActiveForm.Left; FormGrise.Top := Screen.ActiveForm.Top; FormGrise.Width := Screen.ActiveForm.Width; FormGrise.Height := Screen.ActiveForm.Height; FormGrise.DoubleBuffered := True; FormGrise.BorderIcons := Screen.ActiveForm.BorderIcons; FormGrise.BorderStyle := Screen.ActiveForm.BorderStyle; FormGrise.Show; FusionerImage(FormGrise,BitmapForm); FormGrise.BringToFront; BitmapForm.Free; Result:=Fenetre.ShowModal; if FormGrise<>nil then FormGrise.Release; end; End.
Salut,
Bien vu aityahia et merci pour la modif. je n'avais en effet pas remarqué ce point là.
Parceque personne n'a pu me répondre sur le forum C++ Builder, hélas. Vu que c'est la même API, je me suis dit que ça peut valoir le coup. Mais je t'avoue que je galère pas mal. En tout cas, c'est mieux que rien.
kurkaine a écrit :
Le petit hic, est que je développe en C++ Builder, et je n'ai jamais fait de pascal.
Alors pourquoi poster sur le forum Delphi
En fait je fais encore une petite modif :
En effet la solution de aityahia posait un problème si on avait un caption avec un espace. Par exemple 'Form de test'. car il essayait de donner ce texte la comme nom à la form, ce qui n'est pas possible.
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135 {*------------------------------------------------------------------------------ Unité permettant de griser une form lorsqu'elle appelle un showmodal pour en afficher une autre @Author tiki06 (Avec l'aide de Sub0) @Version 02-août-2006 Version initiale -------------------------------------------------------------------------------} Unit UGriserForm; Interface Uses Windows, Forms, Types, Graphics; const PIXELCOUNTMAX = 32768; WS_EX_LAYERED = $80000; type pRGBArray = ^TRGBArray; TRGBArray = ARRAY[0..PIXELCOUNTMAX-1] OF TRGBTriple; Procedure FusionerImage(FusionForm: TForm; BmpGrise: TBitmap); Function CustomShowModal(Fenetre: TForm):integer; implementation {*------------------------------------------------------------------------------ Fonction pour fusioner la form et l'image grisé @param FusionForm Form a fusioner @param BmpGrise Bitmap de l'image grisé -------------------------------------------------------------------------------} Procedure FusionerImage(FusionForm: TForm; BmpGrise: TBitmap); Var Size : PSIZE; TopLeft, BmpTopLeft : TPoint; Blend : TBlendFunction; Begin With FusionForm Do Begin SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) Or WS_EX_LAYERED); New(Size); Size.cx := Width; Size.cy := Height; TopLeft := BoundsRect.TopLeft; BmpTopLeft := Point(0, 0); With Blend Do Begin BlendOp := 0; BlendFlags := 0; SourceConstantAlpha := 255; AlphaFormat := 0; End; BmpGrise.PixelFormat := pf32bit; UpdateLayeredWindow(Handle, GetDC(0), @TopLeft, Size, BmpGrise.Canvas.handle, @BmpTopLeft, 0, @Blend, 2); End; End; {*---------------------------------------------------------------------------- Fonction pour afficher une fenêtre en showmodal et griser celle qui est active pendant l'appel du showmodal @param Fenetre Form a afficher en Showmodal -----------------------------------------------------------------------------} Function CustomShowModal(Fenetre: TForm):integer; var WindowHandle : THandle; deviceContext : HDC; BitmapForm : Tbitmap; icolor : integer; r,g,b:byte; iheight,iwidth : integer; RowOriginal : pRGBArray; FormGrise : TForm; begin WindowHandle:= Screen.ActiveForm.Handle; deviceContext:= GetWindowDC(WindowHandle); try BitmapForm := Tbitmap.Create; BitmapForm.PixelFormat := pf24bit; BitmapForm.Width := Screen.ActiveForm.Width; BitmapForm.Height := Screen.ActiveForm.Height; BitBlt(BitmapForm.Canvas.Handle, 0, 0, BitmapForm.Width, BitmapForm.Height, deviceContext, 0, 0, SRCCOPY); finally ReleaseDC(WindowHandle, deviceContext); end; for iHeight := 0 to BitmapForm.height-1 do begin RowOriginal := pRGBArray(BitmapForm.Scanline[iHeight]); for iWidth := 0 to BitmapForm.width-1 do begin r:=RowOriginal[iWidth].rgbtRed; g:=RowOriginal[iWidth].rgbtGreen; b:=RowOriginal[iWidth].rgbtBlue; icolor:=(r+g+b) div 3; RowOriginal[iWidth].rgbtRed := icolor; RowOriginal[iWidth].rgbtGreen := icolor; RowOriginal[iWidth].rgbtBlue := icolor; end; end; FormGrise := Tform.Create(Screen.ActiveForm); FormGrise.Name := 'GrayscaleForm'; <- J'ai remis cette ligne comme avant ***** FormGrise.Caption := Screen.ActiveForm.Caption; <- j'ai rajouté cette ligne ***** FormGrise.Left := Screen.ActiveForm.Left; FormGrise.Top := Screen.ActiveForm.Top; FormGrise.Width := Screen.ActiveForm.Width; FormGrise.Height := Screen.ActiveForm.Height; FormGrise.DoubleBuffered := True; FormGrise.BorderIcons := Screen.ActiveForm.BorderIcons; FormGrise.BorderStyle := Screen.ActiveForm.BorderStyle; FormGrise.Show; FusionerImage(FormGrise,BitmapForm); FormGrise.BringToFront; BitmapForm.Free; Result:=Fenetre.ShowModal; if FormGrise<>nil then FormGrise.Release; end; End.
c 'est plus judicieux, comme sa on aura pas la contrainte du nom et du caption qu’il soit identique.
sa serai bien de faire un composant avec l'unitée.
Je suis en train de m'en occuper. Ensuite je posterai ça aux modérateurs pour que ça soit mis dans la rubrique Sources delphi du site. Je mettrais le composant et l'unité, comme ça chacuns prendra ce qu'il préfère.sa serai bien de faire un composant avec l'unitée.
salut
j'ai rajouté un test pour gérer le cas ou la fenetre active est une MDIChild elle n'a pas le meme parent
on peut améliorer sa j'ai pas pu récupérer le BorderWidth de la fenetre parent.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 if Screen.ActiveForm.FormStyle = FsMdiChild then begin FormGrise.Top := Screen.ActiveForm.ClientOrigin.Y-(Screen.ActiveForm.Height-Screen.ActiveForm.ClientHeight)+4; FormGrise.Left := Screen.ActiveForm.Left+2; end else Begin FormGrise.Top := Screen.ActiveForm.Top; FormGrise.Left := Screen.ActiveForm.Left; end;
Je précise encore une fois, que j'ai posté dans un forum delphi car personne n'a pu me répondre dans celui de c++ builder. Donc j'essaie d'adapter le code en c++.
Est-ce que je pourrais avoir une précision car j'ai des erreurs de compilations sur
Quel est le type de Result, et ou est déclaré cet attribut.
Code : Sélectionner tout - Visualiser dans une fenêtre à part Result:=Fenetre.ShowModal;
EtJe ne comprends pas quel est le sens de cette ligne ? Qq'un pourrait détaillé en algorithmie qu'est ce qu'on effecture sur cette ligne ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part RowOriginal := pRGBArray(BitmapForm.Scanline[iHeight]);
EnfinSi j'ai bien compris TRGBArrayt est un tableau de type TRGBTriple. Et pRGBArray est pointeur d'une instance de TRGBArray ??
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 pRGBArray = ^TRGBArray; TRGBArray = ARRAY[0..PIXELCOUNTMAX-1] OF TRGBTriple;
Merci de m'aider. Encore une fois désolé de m'éloiger du sujet...
le type de résult est un entier (Int) c'est le resultat de la fonction.
Result n'est pas déclarer c un mot clé c le type de la fonction
Code : Sélectionner tout - Visualiser dans une fenêtre à part Function CustomShowModal(Fenetre: TForm):integer;est equivalent a
Code : Sélectionner tout - Visualiser dans une fenêtre à part CustomShowModal := X;
Code : Sélectionner tout - Visualiser dans une fenêtre à part Result := X;
J'ai donc modifié pour les fenêtre MDI en partant de ce que tu avais fait aityahia. Voila la fonction CustomShowModal modifiée :
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 Function CustomShowModal(Fenetre: TForm):integer; var WindowHandle : THandle; deviceContext : HDC; BitmapForm : Tbitmap; icolor : integer; r,g,b : byte; iheight,iwidth : integer; RowOriginal : pRGBArray; FormGrise : TForm; PosLeft,PosTop,Delta : Integer; begin WindowHandle:= Screen.ActiveForm.Handle; deviceContext:= GetWindowDC(WindowHandle); try BitmapForm := Tbitmap.Create; BitmapForm.PixelFormat := pf24bit; BitmapForm.Width := Screen.ActiveForm.Width; BitmapForm.Height := Screen.ActiveForm.Height; BitBlt(BitmapForm.Canvas.Handle, 0, 0, BitmapForm.Width, BitmapForm.Height, deviceContext, 0, 0, SRCCOPY); finally ReleaseDC(WindowHandle, deviceContext); end; for iHeight := 0 to BitmapForm.height-1 do begin RowOriginal := pRGBArray(BitmapForm.Scanline[iHeight]); for iWidth := 0 to BitmapForm.width-1 do begin r:=RowOriginal[iWidth].rgbtRed; g:=RowOriginal[iWidth].rgbtGreen; b:=RowOriginal[iWidth].rgbtBlue; icolor:=(r+g+b) div 3; RowOriginal[iWidth].rgbtRed := icolor; RowOriginal[iWidth].rgbtGreen := icolor; RowOriginal[iWidth].rgbtBlue := icolor; end; end; FormGrise := Tform.Create(Screen.ActiveForm); FormGrise.Name := 'GrayscaleForm'; FormGrise.Caption := Screen.ActiveForm.Caption; if Screen.ActiveForm.FormStyle = FsMdiChild then begin PosTop := Screen.ActiveForm.ClientOrigin.Y-(Screen.ActiveForm.Height-Screen.ActiveForm.ClientHeight); PosLeft := Screen.ActiveForm.ClientOrigin.X-(Screen.ActiveForm.Width-Screen.ActiveForm.ClientWidth); Delta := round((Application.mainform.Width-Application.MainForm.ClientWidth)/2); FormGrise.Top := PosTop+Delta; FormGrise.left := PosLeft+Delta; end else Begin FormGrise.Top := Screen.ActiveForm.Top; FormGrise.Left := Screen.ActiveForm.Left; end; FormGrise.Width := Screen.ActiveForm.Width; FormGrise.Height := Screen.ActiveForm.Height; FormGrise.DoubleBuffered := True; FormGrise.BorderIcons := Screen.ActiveForm.BorderIcons; FormGrise.BorderStyle := Screen.ActiveForm.BorderStyle; FormGrise.Show; FusionerImage(FormGrise,BitmapForm); FormGrise.BringToFront; BitmapForm.Free; Result:=Fenetre.ShowModal; if FormGrise<>nil then FormGrise.Release; end;
Pour kurkaine, voici quelques explications en plus en espérant t'aider.
Je parcours toutes les lignes de mon bitmap, je stocke dans Roworiginal chaque ligne (En fait je stocke un tableau des couleurs de chaque pixel de ma ligne). Ensuite sur chaque ligne je parcours tous les pixels récupère la couleur et la modifie pour griser l'ensemble.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 for iHeight := 0 to BitmapForm.height-1 do begin RowOriginal := pRGBArray(BitmapForm.Scanline[iHeight]); for iWidth := 0 to BitmapForm.width-1 do begin r:=RowOriginal[iWidth].rgbtRed; g:=RowOriginal[iWidth].rgbtGreen; b:=RowOriginal[iWidth].rgbtBlue; icolor:=(r+g+b) div 3; RowOriginal[iWidth].rgbtRed := icolor; RowOriginal[iWidth].rgbtGreen := icolor; RowOriginal[iWidth].rgbtBlue := icolor; end; end;
Malheureusement je ne pourrais pas t'aider pour transcrire ça en C++.
En espérant avoir put t'aider.
y a toujour un petit décalage
comme ça c'est mieux
Code : Sélectionner tout - Visualiser dans une fenêtre à part Delta := round((Application.mainform.Width-Application.MainForm.ClientWidth)/2)-1;
Pourtant moi je n'avais pas de décalage. Par contre avec ta modif j'ai un décalage. Quelle est la config (propriétés) de tes fenêtres et ton environement ?Envoyé par aityahia
Border style BsSingle
possible que c'est du a ça je fait le test sinon en rajoute les test.
c'est bien ça le problème. moi j'avais un borderstyle à BsSizeable. Apparement ça fait la même chose avec BsToolWindow. c'est nul je pensais que de faire justement la différence entre Width et clientWidth te donnerai la bonne valeur quel que soit le border que l'on a. Je vas faire d'autres tests du coup (en changeant Borderwidth...etc).
Vous avez un bloqueur de publicités installé.
Le Club Developpez.com n'affiche que des publicités IT, discrètes et non intrusives.
Afin que nous puissions continuer à vous fournir gratuitement du contenu de qualité, merci de nous soutenir en désactivant votre bloqueur de publicités sur Developpez.com.
Partager