procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);


  var
  holdColor: TColor;
begin
  holdColor := DBGrid1.Canvas.Brush.Color; {store the original color}

  if DBGrid1.Fields[4].Value = 1  then {only do for the row with a
condition}
     Begin
    //  DBGrid1.Canvas.Brush.Color := clSilver;
      DBGrid1.Canvas.Font.Style := [fsBold];
      DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
     DBGrid1.Canvas.Brush.Color := holdColor;
      DBGrid1.Canvas.Font.Style := [];
    end
else
 begin
      DBGrid1.Canvas.Font.Style := [];
      DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
      DBGrid1.Canvas.Brush.Color := holdColor;
      DBGrid1.Canvas.Font.Style := [];
    end;
end; 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Steven Knight
Sent: Wednesday, 30 March 2005 5:05 p.m.
To: '[email protected]'
Subject: [DUG] Change appearance of grid rows

Hi everyone,

I there a way to change the appearance of rows in the standard Delphi 6
DBGrid dependent on data in the row?

For example: make the text in the grid row bold if a particular field value
is true.

What I am trying to do is build an In/Out board and I want to make it more
obvious when the item is out.


Steven Knight
DBA / Software Developer
Environment Canterbury
PO Box 345, Christchurch
phone: 00 64 3 365-3828 x 7129
email: [EMAIL PROTECTED]

**********************************************************************
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.ecan.govt.nz
**********************************************************************


_______________________________________________
Delphi mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to