代码,你的ra还有一部分空白的区域的。
If CurrentTable.ShowCheckBox = False Then
messagebox.show("请先点击'打印前置'按钮,在想要打印二维码的行的复选框里打√,谢谢!","友情提示")
Else
Dim doc As New PrintDoc
Dim Bar As New BarCodeBuilder
Dim rt As new prt.RenderText
Bar.Symbology = Barpro.Symbology.QRCode
Bar.BarRatio = 0.3
Bar.BarWidth = 1
Bar.BarHeight = 1
Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
If CurrentTable.name = "案卷库" Then
For Each r As Row In CurrentTable.GetCheckedRows
bar.Code = "(1)案卷题名:" & r("案卷题名") & ";(2)编制单位:" & r("编制单位") & ";(3)编制日期:" & r("编制日期")
If r("文件件数") IsNot Nothing And r("文件件数") <> "0" Then
For i As Integer = 1 To Cint(r("文件件数"))
Dim ra As New prt.RenderArea
ra.Style.Padding.Right = 9
ra.Style.BackColor = Color.red
ra.SplitHorzBehavior = prt.SplitBehaviorEnum.Never '禁止水平分割
ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never '禁止垂直分割
ra.width = 39
ra.height = 48
Dim rg1 As New prt.RenderGraphics()
rg1.Graphics.DrawImage(bar.GetImage,0,0,120,120)
rg1.Graphics.DrawImage(getImage("archives.ico"),45,45,30,30)
ra.Children.Add(rg1)
rt = New prt.RenderText
If r("文件件数") > 0 And r("文件件数") < 10 Then
rt.Text = r("档号") & "-0" & i
Else
If i > 0 And i < 10 Then
rt.Text = r("档号") & "-0" & i
Else
rt.Text = r("档号") & "-" & i
End If
End If
rt.Width = "Parent.Width"
rt.Height = 10
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
ra.Children.Add(rt) '添加到容器中
Doc.Body.Children.Add(ra)
Next
End If
Next
Doc.Preview()
End If
End If