1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
   | procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin
  if ARow <> 0 then begin
    with StringGrid1, Canvas do begin
      if Objects[0, ARow] = Tobject(0) then
        Brush.Color := RGB(255, 200, 200)
      else
        Brush.Color := RGB(200, 255, 200);
      FillRect(Rect);
      //TextOut(Rect.Left + 2, Rect.Top + 2, Cells[Acol, ARow]);
      DrawText(Canvas.Handle, PChar(Cells[ACol,ARow]), -1, Rect ,
               DT_CENTER or DT_NOPREFIX or DT_VCENTER or DT_SINGLELINE);
 
    end;
  end;
end; | 
Partager