Solved

Change Cell Color

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

776 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