日期:2014-05-18 浏览次数:20749 次
Bitmap imgGroup = new Bitmap(1055, 869); groupBox1.DrawToBitmap( imgGroup,groupBox1.ClientRectangle ); // 将控件保存为图片,存入imgGroup PrintPreviewDialog pd = new PrintPreviewDialog(); pd.Document = new System.Drawing.Printing.PrintDocument(); ptPreDlg.Document.DefaultPageSettings.Landscape = true; pd.Document.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(Document_PrintPage); pd.ShowDialog(this);
void Document_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawImage(imgGroup , 0, 0); }