/// <summary> /// 打印条形码 /// </summary> /// <param name="lstText">信息列表</param> /// <returns>成功返回true, 失败返回false</returns> static public bool PrintBarcode_Common(List <string> lstText) { IntPtr hDC = IntPtr.Zero; bool bRet = true; double x, y, z; x = 6; y = 4; z = 10; bRet &= BarcodePrint.UTC_Begin(hDC, false); bRet &= BarcodePrint.UTC_Rectangle(x - 1, y - 1, 58, y + (z * lstText.Count()) + 1, 5); y += 4; for (int i = 0; i < lstText.Count; i++) { bRet &= BarcodePrint.UTC_SetFont("黑体", 12, true, false, false, false); bRet &= BarcodePrint.UTC_Text(x, y, lstText[i], 0); bRet &= BarcodePrint.UTC_Line(5, y + 8, 58, y + 8, 5); y += z; } bRet &= BarcodePrint.UTC_Line(16, 16, 16, 4 + (z * lstText.Count()), 5); bRet &= BarcodePrint.UTC_End(); //分页 return(bRet); }
/// <summary> /// 打印实物卡片条形码 /// </summary> /// <param name="cvtNumber">CVT编号</param> /// <returns>成功返回true, 失败返回false</returns> static public bool PrintBarcodeCVTNumberList(List <string> cvtNumber) { IntPtr hDC = IntPtr.Zero; bool bRet = true; double x, y = 0; bRet &= BarcodePrint.UTC_Begin(hDC, false); bRet &= BarcodePrint.UTC_Rectangle(14, 1, 98, 28, 7); bRet &= BarcodePrint.UTC_Line(56, 1, 56, 28, 7); x = 16; y = 3; for (int i = 0; i < cvtNumber.Count; i++) { if (cvtNumber[i].Length > 10) { bRet &= BarcodePrint.UTC_SetFont("黑体", 5, true, false, false, false); } else { bRet &= BarcodePrint.UTC_SetFont("黑体", 20, true, false, false, false); } if (i < 3) { x = 58; if (i != 0) { bRet &= BarcodePrint.UTC_Line(14, y - 2, 98, y - 2, 5); } } else { x = 16; } if (i == 3) { y = 3; } if (i % 3 == 0) { bRet &= BarcodePrint.UTC_Text(x, y - 1, cvtNumber[i], 0); } else { bRet &= BarcodePrint.UTC_Text(x, y - 1, cvtNumber[i], 0); } y = y + 9; } bRet &= BarcodePrint.UTC_End(); //分页 return(bRet); }