Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 27 Apr 2024, 13:42

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 27 Sep 2023, 12:26 
Offline

Joined: 31 Jan 2013, 13:05
Posts: 17
hi. I have a situation, a grid with a memtable in the back. I want to analyze all de field from the 1 line, column by column, after 2 line. 3 line. If in each column i have a condition. If the cell is ok, (with value, not null, numeric/string) the cell color is white, if not i want to color to red. Color the cell, not the column, noy the grid. Each cell :) like a "chess board ".

Please give me a little example.
Thanks.


Top
 Profile  
 
PostPosted: 27 Sep 2023, 12:58 
Offline

Joined: 08 May 2014, 18:06
Posts: 663
Hello

You can use TDBGridEh.OnGetCellParams event to set background color like this:

Code:
procedure TForm1.DBGridEh1GetCellParams(Sender: TObject; Column: TColumnEh;
  AFont: TFont; var Background: TColor; State: TGridDrawState);
begin
  if TColumnEh(Column).Field.AsString = '' then
    Background := TColorRec.Lightsalmon;
end;


Attachments:
sshot-332.png
sshot-332.png [ 31.61 KiB | Viewed 3721 times ]

_________________
Best regards
EhLib Support Team
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 77 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group