[FR] How to centering object by code

PiotrekPiotrek Poland - Świdnica :)
edited 1:57AM in FastReport VCL 5
Hi, how to center barcode? I have licence in company where I work and I have the same problem with my FR4

BarCode get dynamic text, I want to center this object into report.
BarCode.Left := (Page.Width - BarCode.Width) / 2;

// or

BarCode.Align := baCenter; // not working


Comments

  • gpigpi
    edited 1:57AM
    procedure TForm1.frxReport1BeforePrint(Sender: TfrxReportComponent);
    var r: TfrxRect;
        b: TfrxBarcodeView;
    begin
      if Sender is TfrxBarcodeView then
        begin
          b := TfrxBarcodeView(Sender);
            if b.Align = baCenter then
              begin
                b.GetData;
                r := b.GetRealBounds;
                b.Left := (b.Parent.Width - (r.Right - r.Left)) / 2;
              end;
        end;
    end;
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.