Recent

Author Topic: TStringgrid  (Read 4222 times)

Anonymous

  • Guest
TStringgrid
« on: July 14, 2004, 09:21:34 pm »
Hello

I can't color one cell with TStringgrid. How can I do it?

Thanx for all
HLopes

jesusr

  • Sr. Member
  • ****
  • Posts: 484
Re: TStringgrid
« Reply #1 on: July 15, 2004, 06:58:05 am »
Quote from: "Anonymous"
Hello

I can't color one cell with TStringgrid. How can I do it?

Thanx for all
HLopes


This is very easy, select the grid and in the object inspector create a event for OnPrepareCanvas. By clicking in the [...] button lazarus will create a empty handler. There you can write something like:
Code: [Select]

begin
   ...
   // cell[1,1] will be painted as blue  
   if (col=1)and(row=1) then begin    
     stringgrid1.canvas.brush.color := clBlue;
   end;
   ...
end;


Regards.
Jesus Reyes A.

 

TinyPortal © 2005-2018