You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.6 KiB
67 lines
2.6 KiB
3 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Text;
|
||
|
|
||
|
namespace Stone.Common
|
||
|
{
|
||
|
public class MyBarcodePrint
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 打印指定的标签
|
||
|
/// </summary>
|
||
|
/// <param name="DatabasePath">与标签绑定的Access数据路径</param>
|
||
|
/// <param name="TableName">与标签绑定的表名</param>
|
||
|
/// <param name="LabelPath">要打印的标签模板的路径</param>
|
||
|
/// <param name="LabelPage">要打印的标签的份数</param>
|
||
|
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();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 打印指定的标签(通过指定的打印机名)
|
||
|
/// </summary>
|
||
|
/// <param name="DatabasePath">与标签绑定的Access数据路径</param>
|
||
|
/// <param name="TableName">与标签绑定的表名</param>
|
||
|
/// <param name="LabelPath">要打印的标签模板的路径</param>
|
||
|
/// <param name="LabelPage">要打印的标签的份数</param>
|
||
|
/// <param name="PrinterName"></param>
|
||
|
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();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 显示设置窗口
|
||
|
/// </summary>
|
||
|
public static void ShowSet()
|
||
|
{
|
||
|
frmBarcodePrintSet frm = new frmBarcodePrintSet();
|
||
|
frm.ShowDialog();
|
||
|
frm.Dispose();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|