标签:style blog http io ar color os 使用 sp
上一篇说到条码的打印,主要是通过读取模板定义文件(XML文件),然后结合从数据库中读取的动态数据结合而产生条码。下面主要说一下如何设计这个条码模板。设计过程也很简单,只需要简单的拖拉即可。然后点击小箭头或右下角的命令,选择SaveToXmlFile,然后选择路径保存。
上面设计图产生的XML将会是以下的内容。
<?xml version="1.0" encoding="utf-16" standalone="yes"?> <Barcode LabelWidth="639"> <Image X="429" Y="52" Size="2268" Width="162" Height="108" BytesPerLine="24" ImageName="LOGO"> <ImageHex ID="1" HexString="mJ018h07Ch0FC0F8gW0FE1F8gW0FC3FCgW0FC3FCgW0F83F81EgU0783F83FgW03F07FgW01E0HF8gY0" /> <ImageHex ID="2" HexString="HF8gX01HFgY01HFh0FE04gX0FC3F8gW0307FCgY0HFCgN078K01H01HFCgM07HF8K0C01HFCgL01HFCL" /> <ImageHex ID="3" HexString="0601HF8gL07FCM0701HF8gK01HF8M0301HFgL03FEN0380FEgL07FCN01C078078gI0HF8N01EI03HFg" /> <ImageHex ID="4" HexString="I0HFO01EI0IF8gG01FEP0FH01IFCgG03FCP0F803IFCgG03FCP0F807IFEgG07F8P0FC07IFEgG0HFQ0" /> <ImageHex ID="5" HexString="FC0JFEgG0HFQ0FE0JFEg01FEQ0FE0JFCg03FCQ0FE0JFCg07F8Q0FE0JF8g07F8Q0HF07IF8g0HFR0HF" /> <ImageHex ID="6" HexString="07IFg01FER0HF03HFEg03FCQ01HFH0HF8g03FCQ01HFH038gG07F8Q03HFgK0HFR07HFgJ01FER07HFg" /> <ImageHex ID="7" HexString="J01FCR0IFgJ03FCQ01HFEgJ07F8Q03HFEgJ0HFR07HFEgI01FER0IFEgI03FCQ03IFCgI0HF8P01JFCg" /> <ImageHex ID="8" HexString="H01HFP07KF8gH03FCN07MFgI07F8M03MFEgI0HFM01NFCgH01FEM07NF8gH03FCL01OFgI07F8L07NFC" /> <ImageHex ID="9" HexString="gH01HFM0OF8gH01FEL03NFCgI03FCL07MF8gJ07F8L0LFgM0HFL01KFgM01HFL03JFgN01FEL03IFCgN" /> <ImageHex ID="10" HexString="03FEL07IFgO03FCL0IFCgO07FCL0IF8N0202H03U07FCK01IF0HF80FI0707H078J0JF8K07FCK03HFE" /> <ImageHex ID="11" HexString="7HF83FEJ01H078I07KFK07F8K03HF8IF87FEI0FI078H01HFCIFK07F8K07HF1HFE07HF03IFE679H03" /> <ImageHex ID="12" HexString="FCH03F8J07FCK07FE1HFH0IF01IFE679807FCH03F8J07FCK0HFE0EI0IF8K0679807FCH03F8J03FCK" /> <ImageHex ID="13" HexString="0HFCH0181IF8K0279807HF80HF8J03FEJ01HF801F81IF80F8FH078H0MFK03FEJ01HFH01F81IF807H" /> <ImageHex ID="14" HexString="FH078H0HF8O01HFJ03HFK01IF801FCL0FEQ0HFJ07FEH07FC1F9F8L078H0FC7IFEJ0407F8I07FE01I" /> <ImageHex ID="15" HexString="F1F0F80E4207HF80F9KF8I0403FCI0HFC01IF1F0F81E7BCIFC0F9KF8I0601HFH01HF801IF1F0F83C" /> <ImageHex ID="16" HexString="7BEIFC0F8O07H07F801HF8H0IF1F0F87878E7HFC0F8O07801FH03HFL01F0F878F8EK0F9F803FJ078" /> <ImageHex ID="17" HexString="K07HFL01F0F878F0EK0F9F803FJ07EK0HFEI09F81F0F878F0E03I0F9HF31F8I07FJ01HFCI09F31F0" /> <ImageHex ID="18" HexString="F87CF3E078H0F9IFDF8I07F8I07HFCH019F79F0F83EF3CE7B80F8IFCFJ03FEI0IF8H019E79F9F81E" /> <ImageHex ID="19" HexString="F38E7980F8O03HF803IF8H019E79IF8H0FH0E7B80F8H06L01NFI039E79IF8K0E7B80F801F38J01NF" /> <ImageHex ID="20" HexString="I039E79IF80HFEH07801F0FBF3EK0MFEI079E79IF81IF807801F0F3F3EK07LFCI079E79IF03IFCJ0" /> <ImageHex ID="21" HexString="3F0H3F38K07LFCI079E79IF03IF8J03FH03FM03LF8I079F78IF01IF0IF07FQ01LFJ079F38HFEK01I" /> <ImageHex ID="22" HexString="FC7F07IFCL0KFEJ039F307FEI0101IFC7E3KF8K07JFCJ031EH03FCI0F01IFC7E3KF8K01JF8L0EI07" /> <ImageHex ID="23" HexString="J06H0BHF03C1KFM07HFEM06V08H01EO01HF8h08nG0" /> </Image> <Eng_Num_Label Type="Fix" LabelDefine_ZPLII="^FO514,24^ADN,13,10^FDHeXieWu^FS" LabelDefine_EPL2="A514,24,0,2,1,1,N,"HeXieWu"" /> <Eng_Num_Label Type="Fix" LabelDefine_ZPLII="^FO387,176^BY2^BCN,40,Y,N,N,N^FDBarCode^FS" LabelDefine_EPL2="B387,176,0,1,2,2,40,B,"BarCode"" /> <Cht_Label X="429" Y="24" Size="23" Rate="1" Rotate="0" Text="首先" /> </Barcode>
打印出来的效果如下图
大家可以看一下,后续如果此标签需要,可以只修改这个XML的内容便可,下面讲一下这个控件的使用方法。
首先注册printbarcdoe.dll,然后在工程中引入ITBarcode.dll,将ChineseLabel, JapaneseLabel, EnglishNumericLabel, BoxAndLine, ImageLabel, ZPLCommandText, BarcodeTester, 将它们分别加入到Form中即可,在ChineseLabel中: CharacterSize为字符大小, ChineseText为中文字符串, Rate为放大倍数, RotateDegrees为转角.
具体打印代码可以参考上一篇示例代码。
这个可以应付大部分企业的要求。 但仍有其局限性,如中文字无法加粗,EPL不能打QRCode(其实我没找到EPL如何打QRCode.)
不知道各位是如何在程序中实现条码的打印的呢?还有没有更简便的?
如有疑问可以提出,对本文的DLL有兴趣的,可以留下邮箱。
标签:style blog http io ar color os 使用 sp
原文地址:http://www.cnblogs.com/Geton/p/4107944.html