Dim doc As New PrintDoc '定义一个报表
doc.PageSetting.Width = 104
doc.PageSetting.Height = 54
Doc.PageSetting.LeftMargin = 1
Doc.PageSetting.RightMargin = 1
Doc.PageSetting.TopMargin = 1
Doc.PageSetting.BottomMargin = 1
Dim n As Integer = CurrentTable.Rows.Count - 1
For i As Integer = 0 To n
Dim r As Row = CurrentTable.Rows(i)
Dim s1 As Integer = Val(r("数量个"))
Dim ra As New prt.RenderArea
Dim rt As New prt.RenderText
ra.Width = "Parent.Width"
ra.Height = "Parent.height"
ra.SplitHorzBehavior = prt.SplitBehaviorEnum.Never
ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never
Dim Bar As New BarCodeBuilder
Dim img As prt.RenderImage
Bar.Symbology = Barpro.Symbology.Code39
Bar.BarRatio = 0.3 '宽窄比例
bar.barwidth = 0.1 '窄条宽度
Bar.BarHeight = 36 '条码高度
Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
For o As Integer = 1 To s1
ra = New prt.RenderArea
ra.Width = "Parent.Width"
ra.Height = "Parent.height"
ra.SplitHorzBehavior = prt.SplitBehaviorEnum.Never
ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never
'===============以下逐个定义内容
rt = New prt.RenderText
rt.Text = r("产品型号")
rt.x = 2
rt.y = 1
rt.Style.Font = New Font("Arial",14,FontStyle.Bold)
ra.Children.Add(rt)
'绘制第1条线条
Dim Line As New prt.LineDef(0.5, Color.black)
Dim ln As New prt.RenderLine(2,9, 102, 9, Line)
ra.Children.Add(ln) '将线条加入到报表中
'绘制第2条线条
Dim Line2 As New prt.LineDef(0.5, Color.black)
Dim ln2 As New prt.RenderLine(2,17.2, 102, 17.2, Line2)
ra.Children.Add(ln2) '将线条加入到报表中
'绘制第2条型码
Dim dt1 As String = Format(Date.now,"yyyyMMddHHmmssfff")
Dim dt2 As String = dt1.substring(2,6) & "-" & dt1.substring(12,4)
Bar = New BarCodeBuilder
img = new prt.RenderImage
Bar.Code = dt2
img.Image = bar.GetImage
img.x = 1.5
img.y = 18
ra.Children.Add(img)
rt = New prt.RenderText
rt.Text = "1"
rt.x = 37
rt.y = 18
rt.Style.Font = New Font("Arial",14)
ra.Children.Add(rt)
rt = New prt.RenderText
rt.Text = "PC"
rt.x = 47
rt.y = 18
rt.Style.Font = New Font("Arial",14)
ra.Children.Add(rt)
rt = New prt.RenderText
rt.Text = "RUN"
rt.x = 69
rt.y = 18
rt.Style.Font = New Font("Arial",14)
ra.Children.Add(rt)
rt = New prt.RenderText
rt.Text = r("箱号")
rt.x = 90
rt.y = 20
rt.Style.Font = New Font("Arial",14)
ra.Children.Add(rt)
rt = New prt.RenderText
rt.Text = r("销售订单号")
rt.x = 37
rt.y = 25
rt.Style.Font = New Font("Arial",14)
ra.Children.Add(rt)
'绘制第3条线条
Dim Line3 As New prt.LineDef(0.5, Color.black)
Dim ln3 As New prt.RenderLine(2,33, 102, 33, Line3)
ra.Children.Add(ln3) '将线条加入到报表中
Doc.Body.ChildRen.Add(ra)
Next
Next
Doc.Preview() '预览报表
我试过上述代码了,我不断调整 Bar.BarRatio、bar.barwidth 、Bar.BarHeight 三个参数的值,条形码大小都不会发生任何变化。
另外,我的第二个问题(见1楼压缩档案里面)不知道是什么原因?