Avatar of DigitalNam
DigitalNamFlag for Namibia

asked on 

TMS DBGrid

Is there a way to accomplish this in the TMS DBGrid?


procedure TMainForm.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
  if DM.iv_query.FieldByName('Doc_Type').AsString = 'Fax' then
  begin
     DBGrid1.Canvas.Brush.Color:=clWebLightPink;

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

Open in new window

Delphi

Avatar of undefined
Last Comment
DigitalNam
Avatar of jimyX
jimyX

If you are referring to TntDBGrid that in the TMS package then yes that's very possible:
procedure TMainForm.TntDBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
  if DM.iv_query.FieldByName('Doc_Type').AsString = 'Fax' then
  begin
     TntDBGrid1.Canvas.Brush.Color:=clWebLightPink;
     TntDBGrid1.DefaultDrawColumnCell(Rect, DataCol, TTntColumn(Column), State);
  end;
end;

Open in new window

Avatar of DigitalNam
DigitalNam
Flag of Namibia image

ASKER

JimyX: I am using the DBAdvGrid from TMS but the problem is it doesn't have the DrawColumnCell event and no DefaultDrawColumnCell property.
ASKER CERTIFIED SOLUTION
Avatar of Thommy
Thommy
Flag of Germany image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of DigitalNam
DigitalNam
Flag of Namibia image

ASKER

Thank you Thommy. Changed it to:
if DBAdvGrid1.Cells[6,ARow] = 'Fax' then ABrush.Color := clWebLightPink;

Now it works.
Delphi
Delphi

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.

60K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo