Cell Coloring

TeeGrid VCL / FMX for Embarcadero RAD Studio, Delphi, C++ Builder and Lazarus Free Pascal.
Post Reply
ghanshaw
Newbie
Newbie
Posts: 13
Joined: Wed Dec 13, 2017 12:00 am

Cell Coloring

Post by ghanshaw » Wed Dec 13, 2017 3:40 pm

The getting started documentation alludes to individual cell coloring but doesn't give any code specifics. How do I change the color of a specific cell using Delphi?

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Cell Coloring

Post by Yeray » Thu Dec 14, 2017 10:39 am

Hello,

You can use the column OnPaint event as follows:

Code: Select all

  TeeGrid1.Columns[2].OnPaint:=GridOnPaintColumn;

Code: Select all

procedure TFormGridDataset.GridOnPaintColumn(const Sender:TColumn; var AData:TRenderData; var DefaultPaint:Boolean);
begin
  if AData.Row=1 then
    with (Sender.Render as TTextRender) do
    begin
      Format.Brush.Visible:=True;
      Format.Brush.Color:=clRed;

      Paint(AData);
    end
  else
    DefaultPaint:=True;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply