Board index » delphi » TStringGrid and Font Color

TStringGrid and Font Color

Is there a simple way of modifying the font color for just one row of a
TStringGrid?  I've seen allot of postings regarding doing this on the
OnDrawCell Event and setting the DefaultDraw property to false but then I
have to handle the drawing of the remainder of the cells.  Any sample code
and example would be appreciated.  I don't want to use a third party control
since they appear to offer allot of features (bloat) that I don't need.

Thanks.

 

Re:TStringGrid and Font Color


In article <76smam$a...@forums.borland.com>,
  "Daoud Malikyar" <dmalik...@idsonline.com> wrote:
Quote
> Is there a simple way of modifying the font color for just one row of a
> TStringGrid?  I've seen allot of postings regarding doing this on the
> OnDrawCell Event and setting the DefaultDraw property to false but then I
> have to handle the drawing of the remainder of the cells.  Any sample code
> and example would be appreciated.  I don't want to use a third party control
> since they appear to offer allot of features (bloat) that I don't need.

> Thanks.

Try something like this:

procedure TfrmMain.strgrdDrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
  . . .
  if ARow = 0 then begin
    strgrd.Canvas.Brush.Color := clBlack;
    strgrd.Canvas.Font.Color := clYellow;
  end;

Clay Shannon, author of the book "Developer's Guide to Delphi
Troubleshooting" (Wordware 1999)

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

Other Threads