Library Vcl NextSuite 6 NextGrid6 Reference Classes TNxColumn6 OnDrawContent

OnDrawContent

Event called when the content of a cell within the column is being painted and doCustom is included in DrawingOptions property.

pas
property OnDrawContent: TNxDrawCellEvent read FOnDrawContent write FOnDrawContent;

Example

pas
procedure TProductsForm.PriceColumnDrawContent(Sender: TObject; ACol, ARow: Integer; CellRect: TRect; State: TNxCellPaintingState);
var
  IndicatorRect: TRect;
begin
  IndicatorRect := CellRect;
  IndicatorRect.Inflate(-4, -4);
  if ProductsGrid.Cell[ACol, ARow].AsFloat < 0 then
    ProductsGrid.Canvas.Brush.Color := clRed
  else
    ProductsGrid.Canvas.Brush.Color := clGreen;
  ProductsGrid.Canvas.FillRect(IndicatorRect);
end;

Sign in