Draw FNCGrid on a specified TRect

Might seem like an odd request, but is it possible to draw an FNCGrid directly on a specified TRect rather than using that provided by the parent component?

Cheers, Bob

Not at all, it's possible, but only with TTMSFNCDataGrid.

procedure TForm1.PaintBox1Paint(Sender: TObject; Canvas: TCanvas);
var
  g: TTMSFNCGraphics;
begin
  g := TTMSFNCGraphics.Create(Canvas);
  try
    TMSFNCDataGrid1.Root.Export(g, PaintBox1.LocalRect, MakeCellRange(0, 0, TMSFNCDataGrid1.ColumnCount - 1, TMSFNCDataGrid1.RowCount - 1));
  finally
    g.Free;
  end;
end;

Looks interesting thanks - a quick look at the source and it appears that it can do everything the FNCGrid can do (e.g. cell merging, multi-cell selections and virtual mode) plus a lot more? In other words I could use it for spreadsheet-style grids?

Cheers, Bob

Hi,

It's unclear which features for spreadsheet-style grids you refer to, but TTMSFNCDataGrid is the successor of TTMSFNCGrid, so it's preferable to use now and in the future.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.