asked on
ASKER
ASKER
procedure TfrmMain.DupeGridDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
var c1,c2,b1,b2 : string; {TODO : Dupe - DupeGrid Color }
r : integer;
oldc, oldEdcl, oldEdFontCl, oldBrushColor : TColor;
p, Sp : boolean;
begin
c1 := Trim(DM1.Dupe.FieldByName('CallSign').AsString);
c2 := Trim(frmMain.edCallSign.Text);
b1 := Trim(DM1.Du.FieldByName('Area').AsString);
b2 := Trim(edArea.Text);
oldc := DupeGrid.Canvas.Font.Color;
oldBrushColor := DupeGrid.Canvas.Brush.Color;
oldEdcl := clLime; //edCall.Color;
oldEdFontCl := edCall.Font.Color;
if ( c1 = c2 ) // CallSign Match
and (b1 = b2) // Area Match
then
begin
DupeGrid.Canvas.Brush.Color := clRed;
DupeGrid.Canvas.Font.Color := clYellow;
DupeGrid.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end
else
begin
DupeGrid.Canvas.Brush.Color := oldBrushColor; //$00FFD9B3;
DupeGrid.Canvas.Font.Color := oldc;
if length(Trim(edCallSign.Text)) = 0 then
DupeGrid.Canvas.Font.Color := DupeGrid.Canvas.Brush.Color;
DupeGrid.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end;
ASKER
ASKER
ASKER
ASKER
ASKER
Delphi is the most powerful Object Pascal IDE and component library for cross-platform Native App Development with flexible Cloud services and broad IoT connectivity. It provides powerful VCL controls for Windows 10 and enables FMX development for Windows, Mac and Mobile. Delphi is your choice for ultrafast Enterprise Strong Development™. Look for increased memory for large projects, extended multi-monitor support, improved Object Inspector and much more. Delphi is 5x faster for development and deployment across multiple desktop, mobile, cloud and database platforms including 32-bit and 64-bit Windows 10.
TRUSTED BY
here is how to change color for a row in a dbgrid:
https://www.experts-exchange.com/questions/20339601/How-to-make-a-difference-DBGrid-color-for-each-record-in-database.html?anchorAnswerId=7241351#a7241351
for the matches ... you could use a calculated field which does the actual math and sets a value in that field
check the field in the DrawColumnCell event