以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  竖向排列条码打印问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=117244)

--  作者:bobatfoxtable
--  发布时间:2018/4/9 15:03:00
--  竖向排列条码打印问题
请问如何实现这个条码打印效果:

图片点击可在新窗口打开查看此主题相关图片如下:竖向排列条码.png
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看
条码上面出现条码文本
竖向两排排列

--  作者:有点甜
--  发布时间:2018/4/9 15:12:00
--  

参考代码

 

Dim doc As New PrintDoc
Dim img As prt.RenderImage
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code39
Bar.BarRatio = 0.3
Bar.BarHeight = 8
bar.Code = "123456"
img = new prt.RenderImage
img.Image = bar.GetImage
Dim ra As new prt.RenderArea
ra.children.add(img)
Dim rt As new prt.RenderText
rt.text = bar.code
rt.Style.BackColor = Color.white
rt.width = 12
rt.x = 5
rt.y = 2
ra.Children.Add(rt)
Doc.Body.Children.Add(ra)
Doc.Preview()

 


--  作者:有点甜
--  发布时间:2018/4/9 15:20:00
--  

或者

 

Dim doc As New PrintDoc
Dim rg As New prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code39
bar.Code = "123456"
rg = new prt.RenderGraphics
bar.DrawOnCanvas(rg.Graphics,0,0,1.5)
Dim ra As new prt.RenderArea
ra.children.add(rg)
Dim rt As new prt.RenderText
rt.text = bar.code
rt.Style.BackColor = Color.white
rt.width = 12
rt.x = 15
rt.y = 3
ra.Children.Add(rt)
Doc.Body.Children.Add(ra)
Doc.Preview()

 


--  作者:bobatfoxtable
--  发布时间:2018/4/9 15:38:00
--  
请问还要竖向两排排列如何实现?谢谢!
--  作者:bobatfoxtable
--  发布时间:2018/4/9 15:41:00
--  
另外,条码内容是123456,但文本前还要加上 S/N ,请问如何实现
--  作者:有点甜
--  发布时间:2018/4/9 17:14:00
--  
以下是引用bobatfoxtable在2018/4/9 15:41:00的发言:
另外,条码内容是123456,但文本前还要加上 S/N ,请问如何实现

 

参考代码

 

Dim doc As New PrintDoc
Dim rg As New prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code39
Dim tb As New prt.RenderTable() \'定义一个表格对象
doc.Body.Children.Add(tb) \'将表格对象加入到报表中
Dim i As Integer = 0
For Each r As Row In Tables("表A").rows
    bar.Code = r("第一列")
    bar.Text = "SN " & bar.code
    Bar.AddCheckSum = False
    Bar.DisplayChecksum = False
    Bar.DisplayStartStopChar = False
    Bar.DisplayCode = False   
    Bar.TextAlignment = Barpro.Alignment.BelowCenter
    rg = new prt.RenderGraphics
    bar.DrawOnCanvas(rg.Graphics,0,0,1.5)
    Dim ra As prt.RenderArea = tb.Cells(i \\ 2, i Mod 2).area
    ra.children.add(rg)
    Dim rt As new prt.RenderText
    rt.text = bar.code
    rt.Style.BackColor = Color.white
    rt.width = 12
    rt.x = 15
    rt.y = 3
    ra.Children.Add(rt)
    i += 1
Next
Doc.Preview()