const int OPEN_EXISTING = 3; string prnPort = "LPT1"; [DllImport("kernel32.dll", CharSet = CharSet.Auto)] private static extern IntPtr CreateFile(string lpFileName, int dwDesiredAccess, int dwShareMode, int lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, int hTemplateFile);
public POSPrinter(string prnPort) { this.prnPort = prnPort;//打印机端口 } public string PrintLine(string str) {