Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TMS FMX UI Pack
TTMSFMXGrid: How to change spacing between cell text and cell border

You can specify a variable textrect to accomplish this:

procedure TForm1.BeforeDrawGridCell(Sender: TObject; ACanvas: TCanvas;
  var ARect, ATextRect: TRectF; var ADrawText, ADrawBackGround,
  AllowDraw: Boolean);
begin
  InflateRect(ATextRect, -5, 0);
end;

procedure TForm1.TMSFMXGrid1GetCellLayout(Sender: TObject; ACol, ARow: Integer;
  ALayout: TTMSFMXGridCellLayout; ACellState: TCellState);
begin
  ALayout.TextAlign := TTextAlign.Trailing;
end;

procedure TForm1.TMSFMXGrid1GetCellProperties(Sender: TObject; ACol,
  ARow: Integer; Cell: TFmxObject);
begin
  if (Cell is TTMSFMXGridCell) then
  begin
    (Cell as TTMSFMXGridCell).OnBeforeDraw := BeforeDrawGridCell;
  end;
end;