Recent

Author Topic: Color to cell grid! Problem in windows! (SOLVED)  (Read 9262 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2101
    • Lazarus and Free Pascal italian community
Color to cell grid! Problem in windows! (SOLVED)
« on: October 13, 2010, 12:08:33 pm »
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?
« Last Edit: October 18, 2010, 06:54:23 am by xinyiman »
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Color to cell grid! Problem in windows!
« Reply #1 on: October 13, 2010, 02:41:09 pm »
Did you try with the latest Lazarus 0.9.29?

xinyiman

  • Hero Member
  • *****
  • Posts: 2101
    • Lazarus and Free Pascal italian community
Re: Color to cell grid! Problem in windows!
« Reply #2 on: October 13, 2010, 03:15:03 pm »
My Lazarus info

Version #: 0.9.29
Data: 2010-10-01
Versione FPC: 2.4.3
Revisione SVN: 27534
i386-win32-win32/win64
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

bonmario

  • Sr. Member
  • ****
  • Posts: 309
Re: Color to cell grid! Problem in windows!
« Reply #3 on: October 13, 2010, 05:37:16 pm »
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

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Color to cell grid! Problem in windows!
« Reply #4 on: October 13, 2010, 09:58:03 pm »
Canvas.Brush.Style should be set to bsSolid. On Windows the default seems to be bsClear.
Lazarus 1.7 (SVN) FPC 3.0.0

xinyiman

  • Hero Member
  • *****
  • Posts: 2101
    • Lazarus and Free Pascal italian community
Re: Color to cell grid! Problem in windows!
« Reply #5 on: October 15, 2010, 01:38:52 pm »
Neither solution worked!

Help me please!  :o
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Color to cell grid! Problem in windows!
« Reply #6 on: October 15, 2010, 01:44:13 pm »
It works for me.

Lazarus 0.9.29 r24105 FPC 2.4.0 i386-win32-win32/win64

Windows XP.
« Last Edit: October 15, 2010, 01:52:46 pm by typo »

faber

  • Guest
Re: Color to cell grid! Problem in windows!
« Reply #7 on: October 15, 2010, 04:17:43 pm »
I think it's a bug in grids. It works only with older rev.

faber

  • Guest
Re: Color to cell grid! Problem in windows!
« Reply #8 on: October 15, 2010, 04:24:56 pm »
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

  • Hero Member
  • *****
  • Posts: 2101
    • Lazarus and Free Pascal italian community
Re: Color to cell grid! Problem in windows!
« Reply #9 on: October 18, 2010, 06:53:56 am »
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;

Thank you. Is correct!  ;)
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

 

TinyPortal © 2005-2018