Jump to content


philwx

Member Since 05 Aug 2013
Offline Last Active Sep 17 2025 07:21 PM
-----

Topics I've Started

OnDrawContent problem

19 December 2024 - 02:28 PM

I've got a grid with a date column that I'm trying to override the display of so that it shows custom text for certain dates/times instead of the actual date/time.  I've set the column to doBackground and doCustom only, not doContent, and then using the following onDrawContent routine (which obviously doesn't do what I want, just trying to text), and I get blank cells - background as it should be, but nothing painting or writing. 

 

I've tried following the example codes in the demos and on the forum, and it looks like that's all I should need, but is there a step I'm missing? 

 

Thanks for any assistance!

procedure TfrmEditor.drawContent(Sender: TObject; ACol, ARow: Integer; CellRect: TRect; State: TNxCellPaintingState);
   begin
   grid.canvas.font.Color := clYellow;
   grid.Canvas.Pen.Color := clYellow;
   grid.canvas.Ellipse( cellRect.Left, cellRect.Top, cellRect.Right, cellRect.Bottom );
   grid.Canvas.TextRect( cellRect, 0, 0, 'Text' );
   end;