2
我们有一些古老的vb6程序,它使用依赖于窗口字体的打印机对象创建条形码,该对象可以在代码39下正常工作。 最近我们需要将字体切换到code128,经过一些工作,我们将输入转换为code128格式的字符串,并试图使用相同的方法打印,但打印输出看起来不正确(奇怪的是,当我们复制转换后的字符串进入excel并使用相同的代码128字体打印出来,它显示并打印出来)在vb6中使用打印机对象打印Code128条形码(使用字体)
我想知道是否有人有相同的经验,如果有的话,请问有人可以切碎一些灯吗?
以下是我们用来打印出条形码
dim sOrg as string
sOrg = "12345888"
printer.fontName = "code39"
printer.print sOrg 'This prints it out perfectly
'However when we change font to code
'this returns Í,BZx}Î which can be copy onto Excel and print out properly
sOrg = convertTo128(sOrg)
printer.fontName = "Code 128"
printer.print sOrg 'print out with part barcode line, part squares
如果'我,肿消}我的代码'打印ascii字形然后打印机不使用您的Code128字体。在'Printer'设置为正确的设备后,使用'printer.fontName =“Code 128”:msgbox printer.fontName'来确保它被设置为“Code 128”。如果看到其他内容,请检查字体列表以查看是否使用了正确的名称:'for i = 0 to printer.fontCount:debug。? printer.Font(i):next' –
感谢您的输入,但我已检查并且fontName是正确的。但是我们仍然会打印出部分条形码(我怀疑像Í或Î这样的元素被打印为一些正方形,而像B或Z这样的字符被转换成了条形码的线条),这可能与语言设置有关视窗? (但它似乎打印出Í,BZx}Î正确如果我们切换到Arial字体) – user3034931
如果您打印字符串到表单/图片框,打印是否正确? '1Í,BZx}在我的code128字体= http://tinypic.com/view.php?pic=2d0o1f4&s=8#.UxmtLInesfQ –