以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  逐行显示条码的程序报错,请问如何修改  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=65324)

--  作者:hiliuyong
--  发布时间:2015/3/13 17:32:00
--  逐行显示条码的程序报错,请问如何修改

Dim doc As New PrintDoc() \'定义一个报表
Dim rt As prt.RenderText \'定义一个文本对象
Dim rg As prt.RenderGraphics
Dim Bar As BarCodeBuilder
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight \'设置排列方式

For i As Integer = 0 To 10
    Bar.Symbology = Barpro.Symbology.Code128
    bar.Code ="12345678901234567890"
    rg = new prt.RenderGraphics
   
    rg.X = 10
    rg.Y = 25
    bar.BarRatio = 0.8
    bar.BarHeight = 12
    bar.BarWidth = 0.3
    bar.DisplayCode =False
    bar.DrawOnCanvas(rg.Graphics,0,0,1)
   
    rg.Width = 39 \'宽度为39毫米
    rg.Height = 35 \'宽度为35毫米
    rg.Style.Spacing.All = 2 \'设置各个方向的间隔
    rg.Style.Borders.All = New prt.Linedef(1, Color.Red) \'设置边框
    rg.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中
    rg.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中
   
    doc.Body.Children.Add(rg) \'将文本对象加入到报表
   
Next
doc.Preview() \'预览

 

 

在红色部分报错,是什么原因,帮我看下,谢谢!


--  作者:Bin
--  发布时间:2015/3/13 17:35:00
--  
Bar.Symbology =BarCodeEnum.Code128
--  作者:hiliuyong
--  发布时间:2015/3/13 17:52:00
--  

还是无法执行,我把代码改了下,如下

但是无法显示出多条条码

只能显示一个

 

Dim doc As New PrintDoc
Dim img As prt.RenderImage
Dim Bar As New BarCodeBuilder
Dim rg As New prt.RenderGraphics
Bar.Symbology = Barpro.Symbology.Code128
Bar.BarRatio = 0.3
Bar.BarHeight = 8
Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight

For i As Integer = 1 To 4
    bar.Code = "12345678901234567890"
   
    rg = new prt.RenderGraphics
    rg.X = 10
    rg.Y = 25
    bar.BarRatio = 0.8
    bar.BarHeight = 12
    bar.BarWidth = 0.3
    bar.DisplayCode =False
    bar.DrawOnCanvas(rg.Graphics,0,0,1)
  
    Doc.Body.Children.Add(rg)
Next

Doc.Preview()


--  作者:有点甜
--  发布时间:2015/3/13 18:04:00
--  

Dim doc As New PrintDoc
Dim img As prt.RenderImage
Dim Bar As New BarCodeBuilder
Dim rg As New prt.RenderGraphics
Bar.Symbology = Barpro.Symbology.Code128
Bar.BarRatio = 0.3
Bar.BarHeight = 8
\'Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight

For i As Integer = 1 To 4
    bar.Code = "12345678901234567890"
   
    rg = new prt.RenderGraphics
    \'rg.X = 10
    \'rg.Y = 25
    bar.BarRatio = 0.8
    bar.BarHeight = 12
    bar.BarWidth = 0.3
    bar.DisplayCode =False
    bar.DrawOnCanvas(rg.Graphics,0,0,1)
  
    Doc.Body.Children.Add(rg)
Next

Doc.Preview()


--  作者:客人
--  发布时间:2015/3/13 19:38:00
--  
谢谢