Rectangle around barcode

Hi, I'm trying to add a rectangle (dotted line) around a barcode. The creation of barcode is ok, but i need a line around the barcode, as shown in this picture

Comments

  • edited 8:29AM
    Add an empty Text object under the barcode and set a dotted frame around it.
  • edited 8:29AM
    I write this code to generate a preview of my barcode end print it
    procedure TForm1.Button2Click(Sender: TObject);
    var
      page: TfrxReportPage;
      band: TfrxDataBand;
      barco: TfrxBarCodeView;
      ncols, nrows: Integer;
      PaperWidth, PaperHeigth, SpaceBarcodeCol, SpaceBarcodeRow, BarcodeWidth, BarcodeHeigth: Extended;
    begin
      try
        PaperWidth := 210;
        PaperHeigth := 297;
        BarcodeHeigth := 20;
        BarcodeWidth := 80;
        SpaceBarcodeCol := 10;
        SpaceBarcodeRow := 10;
    
        frxRep.Clear;
        frxGetPaperDimensions(DMPAPER_A4, PaperWidth, PaperHeigth);
        TfrxDataPage.Create(frxRep);
    
        page := TfrxReportPage.Create(frxRep);
        page.CreateUniqueName;
        page.PaperSize := DMPAPER_A4;
        page.Orientation := poPortrait;
    
        band := TfrxMasterData.Create(page);
        band.CreateUniqueName;
    
        barco := TfrxBarCodeView.Create(band);
        barco.BarType := bcCode128;
        barco.CalcCheckSum := True;
        barco.Text := 'SPS-DAT-PRI-123354654';
    
        page.LeftMargin := 90;
        page.TopMargin := 40;
    
        ncols := 1;
        nrows := 1;
    
        band.Columns := ncols;
        band.ColumnWidth := BarcodeWidth * fr1cm / 10;
        band.ColumnGap := SpaceBarcodeCol * fr1cm / 10;
        band.Height := (BarcodeHeigth + SpaceBarcodeRow) * fr1cm / 10;
    
        barco.Width := BarcodeWidth * fr1cm / 10;
        barco.Height := BarcodeHeigth * fr1cm / 10;
    
        band.RowCount := ncols * nrows;
    
        frxRep.PrepareReport;
    
        frxRep.SaveToFile(ExtractFilePath(ParamStr(0)) + 'test.txt');
        frxRep.Print;
      except
        on e: exception do
        begin
            ShowMessage(e.Message);
        end;
      end;
    end;
    

    I'm new with this components. How can I create a text object under the barcode at runtme?
  • edited 8:29AM
    Just add this after setting barcode size ...
        barcoFrame := TfrxMemoView.Create(band);
        barcoFrame.SetBounds(
          barco.Left - fr1cm,
          barco.Top - fr1cm,
          barco.Width + 2 * fr1cm,
          barco.Height + 2 * fr1cm
        );
        barcoFrame.Frame.Typ := [ftLeft, ftRight, ftTop, ftBottom];
        barcoFrame.Frame.Style := fsDot;
    
  • edited 8:29AM
    Thanks, it works

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.