procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
with StringGrid1 do
begin
Canvas.FillRect(Rect);
Canvas.Pen.Color := clRed;
Canvas.Brush.Style := bsClear;
Canvas.Rectangle(Rect);
if gdSelected in State then
begin
Canvas.Brush.Color := clBlue;
Canvas.FillRect(Rect);
end;
Canvas.Font.Color := clRed;
DrawText(Canvas.Handle, PChar(Cells[ACol, ARow]), -1, Rect, DT_SINGLELINE or DT_CENTER or DT_VCENTER);
end;
end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
with StringGrid1 do
begin
Canvas.Pen.Color := clRed;
Canvas.Brush.Style := bsClear;
Canvas.Rectangle(Rect);
if gdSelected in State then
begin
Canvas.Brush.Color := clBlue;
Canvas.Brush.Style := bsSolid;
Canvas.FillRect(Rect);
end;
end;
end;