[Lazarus] Colouring StringGrids

Coppola Ing. Salvatore coppolastudio at gmail.com
Tue Jul 15 21:52:48 CEST 2008


Dave Coventry wrote:
> Hi Hector,
>
> Thanks for the help.
>
> I've tried the code as you suggest, but it only seems to affect the
> selected row.
>
> I'm having difficulty following the logic process.
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>   
Maybe this can help yuo:
procedure TForm1.StringGrid1DrawCell(Sender: TObject; aCol, aRow: Integer;
aRect: TRect; aState: TGridDrawState);
begin
  if (aCol=aRow) then begin
    StringGrid1.Canvas.Brush.Color:=clYellow;
    StringGrid1.Canvas.Rectangle(StringGrid1.CellRect(aCol,aRow));
  end;
end;

Regards,
Salvatore



More information about the Lazarus mailing list