BarCodeBuilder

BarCodeBuilder有BarCode的全部属性和成员。
BarCodeBuilder不需要加入到窗口中,即可生成条形码图片。

示例一

Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code39
Bar.Code =
"123456"
Bar.BarWidth =
0.3
Bar.BarHeight =
8
Bar.SaveImage(
"c:\data\MyBar.jpg"
)

示例二

假定表A有一个名为"条码"的列,希望批量打印出所有条码,代码为:

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
Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight

For
Each r As Row In Tables("表A").Rows
    bar.Code = r(
"条码")
    img = new prt.RenderImage
    img.Image = bar.GetImage
    Doc.Body.Children.Add(img)

Next

Doc.Preview()

如果你想每行打印四个条码,可以用下面的代码:

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
Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight

For
Each r As Row In Tables("表A").Rows
    For
i As Integer = 1 To 4
        bar.Code = r(
"条码")
        img = new prt.RenderImage
        img.Image = bar.GetImage
        Doc.Body.Children.Add(img)

    Next
Next

Doc.Preview()

小提示:

你也许会有困惑,帮助并没有介绍BarCodeBuilder的属性,实际编码的时候如何设置其属性呢?
不用担心,Foxtable为您考虑得非常周到,请参考:自动生成条形码代码

 

 


本页地址:http://www.foxtable.com/webhelp/topics/1949.htm