111,094
社区成员




/// <summary>
/// 打印LD面单指定图片
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void printDocument_PrintLDPage(object sender, PrintPageEventArgs e)
{
try
{
e.Graphics.PageUnit = GraphicsUnit.Millimeter;
Image image = Image.FromFile(Application.StartupPath + "\\inc\\codePrintLD.jpg");
e.Graphics.DrawImage(image, new Rectangle(0, 0, 100, 180));
image.Dispose();
}
catch
{
}
}
/// <summary>
/// 打印立达面单
/// </summary>
/// <param name="printModel"></param>
/// <returns></returns>
public bool printLDImg(printInfo printModel, string expressId) {
this.printDocument = new PrintDocument();
this.printDocument.PrintPage += new PrintPageEventHandler(this.printDocument_PrintLDPage);
try
{
if (!this.MakePrintLDImg(printModel,expressId)) // 生成需要打印的 codePrintLD.jpg
{
return false;
}
// TODO: 临时注释,LD面单打印功能,等开发完成后放开
PrintController controller = new StandardPrintController();
this.printDocument.PrintController = controller;
this.printDocument.Print();
return true;
}
catch
{
this.printDocument.PrintController.OnEndPrint(this.printDocument, new PrintEventArgs());
return false;
}
}