<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Comments for Colorizing a TDBGrid</title>
<link rel="alternate" type="text/plain" href="http://edn.embarcadero.com/article/20845" title="Colorizing a TDBGrid" />
<link rel="self" type="application/atom+xml" href="http://edn.embarcadero.com/article/20845/feed" title="Comments for Colorizing a TDBGrid" />
<id>http://edn.embarcadero.com/article/20845</id>
<updated>2013-05-26T02:36:59-07:00</updated>
<entry>
<title>re: Colorizing a TDBGrid</title>
<author>
<name>Geoff McCarron-Benson</name>
<uri>http://threads.embarcadero.com/threads/threads.exe/userall?commentid=26220</uri>
</author>
<id>http://threads.embarcadero.com/threads/threads.exe/view?commentid=26220</id>
<updated>2000-08-27T02:35:24-07:00</updated>
<published>2000-08-27T02:35:24-07:00</published>
<summary>re: Colorizing a TDBGrid</summary>
<content>Try this to colour an entire row in Delphi 4 rather than using the OnDataDataCell event which is suppose to be obsolete.1. Set the DefaultDrawing property to FALSE2. Create the following OnDrawColumnCell eventIn this example, my list is called MainListprocedure TSwitchPurchases.MainListDrawColumnCell(Sender: TObject;  const Rect: TRect; DataCol: Integer; Column: TColumn;  State: TGridDrawState);begin  if MainTbl.FieldByName('isactive').Asinteger = 0    then MainList.canvas.font.color := clRed;  MainList.DefaultDrawColumnCell(Rect, DataCol, Column, State);  inherited;end;There is a comment in the help about focus rectangles that you may also need to look at.If there is a better way, let me know please.</content>
</entry>
<entry>
<title>re: Colorizing a TDBGrid</title>
<author>
<name>William Grace</name>
<uri>http://threads.embarcadero.com/threads/threads.exe/userall?commentid=24695</uri>
</author>
<id>http://threads.embarcadero.com/threads/threads.exe/view?commentid=24695</id>
<updated>2000-03-27T08:34:52-07:00</updated>
<published>2000-03-27T08:34:52-07:00</published>
<summary>re: Colorizing a TDBGrid</summary>
<content>If you want to color the entire row based on the value of one cell, use the syntax FIELD.DATASET.FIELDBYNAME('yourkeyfield').ASdatatype</content>
</entry>
<entry>
<title>Colorizing a TDBGrid</title>
<author>
<name>Richard Lees</name>
<uri>http://threads.embarcadero.com/threads/threads.exe/userall?commentid=24346</uri>
</author>
<id>http://threads.embarcadero.com/threads/threads.exe/view?commentid=24346</id>
<updated>2000-03-01T00:16:32-08:00</updated>
<published>2000-03-01T00:16:32-08:00</published>
<summary>Colorizing a TDBGrid</summary>
<content>This is OK for addressing individual cells, but how do I set whole grid rows to a specific colour (aka MS Money)?.</content>
</entry>
<entry>
<title>Colorizing a TDBGrid</title>
<author>
<name>Piotr Gawronski</name>
<uri>http://threads.embarcadero.com/threads/threads.exe/userall?commentid=24211</uri>
</author>
<id>http://threads.embarcadero.com/threads/threads.exe/view?commentid=24211</id>
<updated>2000-02-16T01:35:38-08:00</updated>
<published>2000-02-16T01:35:38-08:00</published>
<summary>Colorizing a TDBGrid</summary>
<content>AFAIR in Delphi 4 and newer it is recommended to use DefaultDrawColumnCell and OnDrawColumnCell event</content>
</entry>
</feed>
