-- 作者:99473593
-- 发布时间:2014/9/25 21:43:00
-- [求助]请高手修改下这段条码打印打码,排版 问题
江湖救急,请高手帮我改下这段条码,排版横向间距方面有问题,研究大晚上还是不行,每行的第二,第三个条码老是打不到条码纸上。
此主题相关图片如下:20140925_2142241.jpg
Dim txt1 As String = e.Form.Controls("TextBox1").Text \'定义变量,用于手动输入打印数量 Dim cmb1 As String = e.Form.Controls("ComboBox1").Text \'定义变量,用于手动选择打印机
Dim doc As New PrintDoc doc.PageSetting.Width = 105 \'纸张宽度为200毫米 doc.PageSetting.Height = 17 \'纸张高度为170毫米 DoC.PageSetting.LeftMargin = 1 \'设置左侧边距为2毫米 DoC.PageSetting.RightMargin = 1 \'设置右侧边距为2毫米 DoC.PageSetting.TopMargin = 1 \'设置顶部边距为2毫米 Doc.PageSetting.BottomMargin = 1 \'底部边距未1毫米 Doc.Style.TextAlignHorz = prt.AlignVertEnum.Center \'垂直居中 \' DoC.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 DoC.Style.TextAlignHorz = prt.AlignHorzEnum.Right \'右对齐 doc.PageSetting.Landscape = True \'横向打印 doc.AutoRotate = False \'如果纸张的宽度超过高度,要加上这行代码 Dim rg As prt.RenderGraphics Dim Bar As New BarCodeBuilder Bar.Symbology = Barpro.Symbology.Code128 Bar.BarWidth = 0.25 \'窄条宽度 Bar.BarRatio = 2.3 \'设定宽窄比例 Bar.BarHeight = 5 \'设定条码高度 Bar.QuietZoneWidth = 2 \'静区宽度
Dim t As Table = Tables("ShangPinXiangXiZiLiao") \'指定数据来源表 Dim ra As prt.RenderArea For i As Integer = t.TopPosition To t.BottomPosition Dim r As Row = t.Rows(i) For j As Integer = 0 To val(txt1) - 1 \'指定每行打印数量 If j Mod 3 = 0 Then ra = new prt.RenderArea Doc.Body.Children.Add(ra) End If bar.Code = r("ShangPinXiangXiZiLiao_ShangPinHuoHao") \'指定条码数据来源列 Bar.QuietZoneWidth = 2 Bar.CodeAlignment = Barpro.Alignment.BelowJustify Bar.Text = "BOBOYA ¥" & r("ShangPinXiangXiZiLiao_LingShouJia") & "元" \'指定条码上方文本说明 Bar.TextFont = New Font("宋体",9,FontStyle.Bold) \'定义说明文本字体及字号 Bar.TextAlignment = Barpro.Alignment.AboveLeft rg = new prt.RenderGraphics bar.DrawOnCanvas(rg.Graphics,0,0,1) rg.Stacking = prt.StackingRulesEnum.InlineLeftToRight \'设置容器中对象的排列方式 rg.Style.TextAlignHorz = prt.AlignVertEnum.Center \'垂直居中 \' rg.Style.Spacing.Bottom = 1 \' rg.Style.Spacing.Right = 1 \'设置右间间隔毫米 \' rg.Style.Spacing.Left = 1 \'左边距 rg.Style.TextAlignHorz = prt.AlignVertEnum.Center \'垂直居中 \' rg.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 rg.Style.TextAlignHorz = prt.AlignHorzEnum.Right \'右对齐 ra.Stacking = prt.StackingRulesEnum.InlineLeftToRight \'设置容器中对象的排列方式 ra.Style.TextAlignHorz = prt.AlignVertEnum.Center \'垂直居中 ra.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中 \' ra.Style.Spacing.ALL = 1 \'设置下间隔为3毫米 \' ra.Style.Spacing.Bottom = 2 \'设置下间隔为3毫米 \' ra.Style.Spacing.Right = 10 \'设置右间间隔毫米 \' ra.Style.Spacing.Left = 3 \'左边距 ra.Children.Add(rg) Next Next Doc.PrinterName = cmb1 \'指定打印机 Doc.Preview() \'打印预览 \'Doc.Print \'直接打印
[此贴子已经被作者于2014-9-25 21:45:31编辑过]
|