TTMSFMXGrid Aligning Bitmaps

TMSFMXGrid1.HorzAlignments[1,7] := TTextAlign.taTrailing;
TMSFMXGrid1.AddBitmap(1,7,'1');

Results in the image being left aligned. Is there another way of doing this?

Regards,

Ken

The HorzAlignments is used for the text, not for the bitmap, the bitmap is always left-aligned unless you implement the OnGetCellProperties and change the alignment:


procedure TForm1.TMSFMXGrid1GetCellProperties(Sender: TObject; ACol,
  ARow: Integer; Cell: TFmxObject);
begin
  if Cell is TTMSFMXBitmapGridCell then
    (Cell as TTMSFMXBitmapGridCell).Bitmap.Align := TAlignLayout.Client;
end;

Thanks, that works a treat. One more question if I may. How do I set which borders are to be displayed for an individual cell?

In the OnGetCellLayout event you can set the Sides property


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

Thanks, but this does not then reflect when exported to a PDF.

When we apply this on the PDF export demo, the image are drawn correctly in the PDF:


procedure TForm1.TMSFMXGrid1GetCellProperties(Sender: TObject; ACol,
  ARow: Integer; Cell: TFmxObject);
begin
  if (Cell is TTMSFMXBitmapGridCell) then
    (Cell as TTMSFMXBitmapGridCell).Bitmap.Align := TAlignLayout.Client;
end;




Sorry Pieter, I have confused things by asking about 2 different things in the same topic. I was referring to using OnGetCellLayout to set the Sides. It is when using this to change the sides that it does not reflect the same in the PDF. I do not seem to be able to set the thickness of the border either.

Unforunately the borders are not reflected in the PDF. We will investigate if we can improve this behavior.

Thanks Pieter. I'm going to have to stop trying to use a grid to produce a PDF which replicates a form then. Unfortunately I'm not having much luck doing this using any components. I am currently using Teechart but that also has problems. It's about time a cross platform report generator was available for Firemonkey!