سلام.
سوالم فکر کنم ساده است ولی بلد نیستم.میخوام وقتی روی استرینگ گرید کلیک می کنم رکورد جاری رنگی بشه.
فکر می کردم این کد جواب بده ولی کار نکرد:
var
Form1: TForm1;
LastRow:Word=1;
implementation
..
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
I: Integer;
R:TRect;
begin
With StringGrid1 Do
Begin
Canvas.Brush.Color := clWhite;
For I:=1 to ColCount do
Begin
R:=CellRect(I,LastRow);
Canvas.FillRect(R);
Canvas.TextRect(R,R.Left + 2, R.Top + 2, cells[I, LastRow]);
End;
Canvas.Brush.Color := $00FFEBDF;
For I:=1 to ColCount do
Begin
R:=CellRect(I,ARow);
Canvas.FillRect(R);
Canvas.TextRect(R,R.Left + 2, R.Top + 2, cells[I, ARow]);
End;
LastRow:=ARow;
End;
end;