Color to cell grid! Problem in windows! (SOLVED) lazarus / 39-Graphics ---------------------------------------------------------------------- xinyiman · 2010-10-13 10:08 procedure TForm1.Grid_RisultatoDrawCell(Sender: TObject; aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState); var    P : Array[0..200] Of Char; begin      If {(aCol = 1) And }(aRow = 0) Then         begin              Grid_Risultato.Canvas.Brush.Color := clGray;              Grid_Risultato.Canvas.Pen.Color := clGray;              Grid_Risultato.Canvas.Font.Color := clYellow;              Grid_Risultato.Canvas.Rectangle(aRect.Left, aRect.Top, aRect.Right, aRect.Bottom);         end; end; Why this works in Linux makes the cells in the first row of the grid with a gray background and yellow writing on Windows XP and does not display anything but a blank rectangle? ---------------------------------------------------------------------- felipemdc · 2010-10-13 12:41 Did you try with the latest Lazarus 0.9.29? ---------------------------------------------------------------------- xinyiman · 2010-10-13 13:15 My Lazarus info Version #: 0.9.29 Data: 2010-10-01 Versione FPC: 2.4.3 Revisione SVN: 27534 i386-win32-win32/win64 ---------------------------------------------------------------------- bonmario · 2010-10-13 15:37 Try this: Code: [Select]procedure TForm1.Grid_RisultatoPrepareCanvas(sender: TObject; aCol, aRow: Integer;   aState: TGridDrawState); var    P : Array[0..200] Of Char; begin      If {(aCol = 1) And }(aRow = 0) Then         begin              Grid_Risultato.Canvas.Brush.Color := clGray;              Grid_Risultato.Canvas.Font.Color := clYellow;         end; end; Hi, Mario ---------------------------------------------------------------------- Ocye · 2010-10-13 19:58 Canvas.Brush.Style should be set to bsSolid. On Windows the default seems to be bsClear. ---------------------------------------------------------------------- xinyiman · 2010-10-15 11:38 Neither solution worked! Help me please! ---------------------------------------------------------------------- typo · 2010-10-15 11:44 It works for me. Lazarus 0.9.29 r24105 FPC 2.4.0 i386-win32-win32/win64 Windows XP. ---------------------------------------------------------------------- faber · 2010-10-15 14:17 I think it's a bug in grids. It works only with older rev. ---------------------------------------------------------------------- faber · 2010-10-15 14:24 try in this way Code: [Select]     if (aRow = 0) Then begin         StringGrid1.Canvas.Font.Color := clYellow;         StringGrid1.Canvas.Brush.Color := clGray;         StringGrid1.DefaultDrawCell(ACol,ARow, ARect, AState);      end; ---------------------------------------------------------------------- xinyiman · 2010-10-18 04:53 Quote from: faber on October 15, 2010, 04:24:56 pmtry in this way Code: [Select]     if (aRow = 0) Then begin         StringGrid1.Canvas.Font.Color := clYellow;         StringGrid1.Canvas.Brush.Color := clGray;         StringGrid1.DefaultDrawCell(ACol,ARow, ARect, AState);      end; Thank you. Is correct!