C# 使用 BarTender 条码标签打印处理的例子
没啥技术含量
就是和那个 GettingStartedwithActiveXAutomationUsingCsharp 的白皮书里面说的一样
先引用一个 BarTender 的 Com. 然后就是
BarTender.Application btApp; BarTender.Format btFormat;
private void Form1_Load(object sender, EventArgs e) {
btApp = new BarTender.Application(); }
private void Form1_FormClosed(object sender, FormClosedEventArgs e) {
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges); }
private void button2_Click(object sender, EventArgs e) {
btFormat = btApp.Formats.Open(@\// 同样标签的份数
// 也就是一个标签,打印多少份 // 系统默认是 1
// 当1个标签,需要打印多份的时候,修改这个参数 // 例如: 需要打印某种 无序号物品的标签 // 需要打印 20个物品的标签。
// 这20个标签的 号码,都是一样的。
btFormat.PrintSetup.IdenticalCopiesOfLabel = 1;
// 序列标签数
// 当这个数字大于1的时候,会额外的打其他的标签。 // 例如 下面的 ZB1000 12345678
// 当序列标签数 = 4 的时候。 (好像系统默认是 4) // 会打印出
// ZB1000 12345678
// ZB1000 12345679 // ZB1000 12345680 // ZB1000 12345681 // 4张标签。
btFormat.PrintSetup.NumberSerializedLabels = 1;
btFormat.SetNamedSubStringValue(\测试 V1.0\
btFormat.SetNamedSubStringValue(\btFormat.PrintOut(false, false);
btFormat.SetNamedSubStringValue(\测试 V2.0\
btFormat.SetNamedSubStringValue(\btFormat.PrintOut(false, false); }
主要是在C# 程序中,需要正确的填写
btFormat.PrintSetup.IdenticalCopiesOfLabel 与
btFormat.PrintSetup.NumberSerializedLabels 的数值。
全部都填写1的话, 也不是不可以,就是某些情况下,太浪费纸了,呵呵。