1 private BarTender.Application btAPP; 2 private BarTender.Format btFormat; 3 //初始化对象 4 btAPP = new BarTender.Application(); 5 6 try 7 { 8 btFormat = btApp.Formats.Open(AppDomain.CurrentDomain.BaseDirectory + "labCloth1.btw", false, ""); 9 10 //向bartender模板传递变量,SN为条形码数据的一个共享名称 11 btFormat.SetNamedSubStringValue("SN", sn_string); 12 btFormat.SetNamedSubStringValue("NUM", DateTime.Now.Minute.ToString()); 13 btFormat.SetNamedSubStringValue("LEN", 50.24.ToString()); 14 15 //选择打印机 16 btFormat.Printer = InitprinterComboBox.Text; 17 18 //设置打印份数 19 int CopiesOfLabel = Int32.Parse(this.PrintLabNum.Text.ToString()); 20 btFormat.IdenticalCopiesOfLabel = CopiesOfLabel; 21 22 //设置打印时是否跳出打印属性 23 btFormat.PrintOut(false, false); 24 25 //退出时是否保存标签 26 btFormat.Close(BarTender.BtSaveOptions.btSaveChanges); 27 } 28 catch (Exception ex) 29 { 30 MessageBox.Show("错误信息: " + ex.Message); 31 return; 32 } 33 // 34 btAPP.Quit(BarTender.BtSaveOptions.btSaveChanges);//界面退出时同步退出bartender进程
标签:调用,BarTender,SetNamedSubStringValue,标签,btAPP,打印,ToString,btFormat From: https://www.cnblogs.com/kingkie/p/17833155.html