码迷,mamicode.com
首页 > Windows程序 > 详细

Winform 打印面单

时间:2015-08-25 18:28:35      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:

private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Bitmap bit = new Bitmap(this.Width, this.Height);
this.MdPanel.DrawToBitmap(bit, new Rectangle(0, 0, this.Width, this.Height));
e.Graphics.DrawImage(bit, 0, 0);
bit.Dispose();
}


private void FormExpress_Shown(object sender, EventArgs e)
{
//打印
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
//pd.Print();
if (printpreview == true)
{
PrintPreviewDialog cppd = new PrintPreviewDialog();
cppd.Document = pd;
cppd.ShowDialog();
}
else
{
pd.Print();

}
this.Close();
}

Winform 打印面单

标签:

原文地址:http://www.cnblogs.com/panjuan/p/4757669.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!