yassou2004
Messages postés2Date d'inscriptionlundi 29 novembre 2004StatutMembreDernière intervention 1 juin 2007
-
1 juin 2007 à 15:25
yassou2004
Messages postés2Date d'inscriptionlundi 29 novembre 2004StatutMembreDernière intervention 1 juin 2007
-
1 juin 2007 à 20:29
Bonjour a tous et à toutes
voila g une stringgrid rempli avec des données,
et j'aimerais savoir comment mettre les doublons en évidence(no pas les supprimer)?
yassou2004
Messages postés2Date d'inscriptionlundi 29 novembre 2004StatutMembreDernière intervention 1 juin 2007 1 juin 2007 à 20:29
voila g fait ce petit code ms ca marche pas trop:
procedure TForm2.Button1Click(Sender: TObject);
begin
l:=StringGrid1.RowCount-1;
setlength(tcol,l);
for i:= 0 to l-1 do
begin
Tcol[i]:=false;
end;
for i:=0 to StringGrid1.RowCount-1 do
begin
sDoublon:=StringGrid1.Cells[1,i];
for j:=0 to StringGrid1.RowCount-1 do
begin
if ((sDoublon = StringGrid1.Cells[1,j]) and (i<>j))then
begin
TCol[i]:= true;
end;
end;
end;
end;
procedure TForm2.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var k:integer;
begin
With Sender As TStringGrid Do With Canvas Do
Begin
If gdFixed in State
Then Brush.Color := clBtnFace
Else If gdSelected In State
Then Brush.Color := clNavy
Else If Odd(ARow)
Then Brush.Color := $FFE0FF
Else Brush.Color := $FFFFE0;
FillRect(Rect);
If gdSelected In State
Then Font.Color:=clWhite
Else Font.Color:=clBlack;
for k:= 0 to l-1 do
begin
if Tcol[k]=true then font.Color:=clRed;
end;
TextOut(Rect.Left,Rect.Top,Cells[ACol,ARow]);
End;
end;