- This topic has 1 reply, 2 voices, and was last updated 2018-10-05 at 3:00 am by .
Viewing 1 reply thread
Viewing 1 reply thread
- You must be logged in to reply to this topic.
Home › Forums › Konopka Signature VCL Controls (formerly Raize Components) › TrzDbGrid
Good morning.
I use TrzDbGrid (ver 6.2.2) with Delphi 10.0.
I defined an event (OnDrawColumnCell) but the event is never called. I followed with debug, I see that OnDrawColumnCell runs in vcl.dbgrids but never the one defined in my program. Some idea?
Hi,
In order for the OnDrawColumnCell event to fire, you need to set the DefaultDrawing property to False. Then you need to handle drawing the content of all the cells. Here is a simple example:
procedure TForm29.RzDBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
if Column.FieldName = 'AB' then
RzDBGrid1.Canvas.Brush.Color := clRed
else
RzDBGrid1.Canvas.Brush.Color := clYellow;
RzDBGrid1.DefaultDrawColumnCell( Rect, DataCol, Column, State );
end;
The code above results in every cell of the grid having a background of Yellow, except for the ‘AB’ column which has a background color of Red. The DefaultDrawColumnCell method is used to actually to the drawing.
Ray
We use cookies to improve your experience on our site. By using our site, you consent to cookies.
Manage your cookie preferences below:
Essential cookies enable basic functions and are necessary for the proper function of the website.
These cookies are needed for adding comments on this website.
These cookies are used for managing login functionality on this website.
Stripe is a payment processing platform that enables businesses to accept online payments securely and efficiently.
Service URL: stripe.com (opens in a new window)