Solved

Change Cell Color

Posted on 1998-12-31
1
264 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now