using System; using System.Collections.Generic; using System.Text; namespace Stone.Common { public class MyBarcodePrint { /// /// 打印指定的标签 /// /// 与标签绑定的Access数据路径 /// 与标签绑定的表名 /// 要打印的标签模板的路径 /// 要打印的标签的份数 public static void Print(string DatabasePath, string TableName, string LabelPath, int LabelPage) { //条码打印 string LMW32_PATH, LABEL_PATH, DATA_PATH, cmdline, parameter; LMW32_PATH = MyAppconfig.ReadValue("Lmw32Path"); LABEL_PATH = LabelPath; DATA_PATH = DatabasePath; cmdline = "\"" + LMW32_PATH + "\\Lmwprint.exe\""; parameter = "/L=\"" + LABEL_PATH + "\" /D=" + LabelPage.ToString() + " "; parameter += " /File=" + TableName + ",\"" + DATA_PATH + "\""; System.Diagnostics.Process.Start(cmdline, parameter).WaitForExit(); } /// /// 打印指定的标签(通过指定的打印机名) /// /// 与标签绑定的Access数据路径 /// 与标签绑定的表名 /// 要打印的标签模板的路径 /// 要打印的标签的份数 /// public static void Print(string DatabasePath, string TableName, string LabelPath, int LabelPage, string PrinterName) { //条码打印 string LMW32_PATH, LABEL_PATH, DATA_PATH, cmdline, parameter; LMW32_PATH = MyAppconfig.ReadValue("Lmw32Path"); LABEL_PATH = LabelPath; DATA_PATH = DatabasePath; cmdline = "\"" + LMW32_PATH + "\\Lmwprint.exe\""; parameter = "/L=\"" + LABEL_PATH + "\" /D=" + LabelPage.ToString() + " "; parameter += " /File=" + TableName + ",\"" + DATA_PATH + "\""; parameter += " /X=" + PrinterName; System.Diagnostics.Process.Start(cmdline, parameter).WaitForExit(); } /// /// 显示设置窗口 /// public static void ShowSet() { frmBarcodePrintSet frm = new frmBarcodePrintSet(); frm.ShowDialog(); frm.Dispose(); } } }