同一报告中的条形码重复

时间:2015-09-02 13:35:43

标签: vb.net devexpress xtrareport

我想在同一报告页面中打印相同条形码的确定数量,我使用此代码但不起作用:

' ###### I try to repeat the function to generate the same barcode 6 times #######
Private Sub ExampleBarcode_BeforePrint(sender As Object, e As System.Drawing.Printing.PrintEventArgs) Handles Me.BeforePrint
    For i As Integer = 1 To 6
        Me.Detail.Controls.Add(CreateQRCodeBarCode("01234ft78"))
    Next
End Sub

Public Function CreateQRCodeBarCode(ByVal BarCodeText As String) As XRBarCode

    Dim barCode As New XRBarCode()

    barCode.Symbology = New Code128Generator()

    barCode.Text = BarCodeText
    barCode.Width = 240
    barCode.Height = 70

    barCode.Module = 1

    CType(barCode.Symbology, Code128Generator).CalcCheckSum = False
    CType(barCode.Symbology, Code128Generator).CharacterSet = Code128Charset.CharsetAuto
    Return barCode
End Function

1 个答案:

答案 0 :(得分:2)

您的条形码位于同一位置。您需要为每个控件设置不同的位置。为此,您可以使用LeftFTopF属性 这是一个例子:

For i As Integer = 0 To 5
    Dim barCode = CreateQRCodeBarCode("01234ft78")
    barCode.TopF = i * barCode.HeightF

    Me.Detail.Controls.Add(barCode)
Next