Solved

Change Cell Color

Posted on 1998-12-31
1
267 Views
Last Modified: 2010-04-04
I know this question has been asked before but I don't have the time to search the 4000 previous questions.
I need to change the color of one cell in a DBGrid depending on what data is in the cell. If it is 'Y' i need the cell to be Red, else white. I don't want to change the whole coloumn. I know how to do that. i just want to change the one cell, or multiple cells if there is more than one record that has 'Y' for that field.
Thanks
bozo
0
Comment
Question by:bozo7
1 Comment
 
LVL 1

Accepted Solution

by:
adeng earned 100 total points
ID: 1353954
first set DBGrid 'Default Drawin' property to False and write this code on DrawColumnCell :

procedure TfrmPenjualan.JurnalGridDrawColumnCell(Sender: TObject;
          const Rect: TRect; DataCol: Integer; Column: TColumn;
          State: TGridDrawState);
begin
     with DataModule1 do
          if  (qryItemPenjualanJUMLAH.Value > 20 ) then
               JurnalGrid.Canvas.Font.COLOR := clRed;

     JurnalGrid.DefaultDrawColumnCell(Rect, DataCol, Column, State);        
end;

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question