问题描述
privatevoidbutton1_Click(objectsender,EventArgse){PrintDocumentpdDocument=newPrintDocument();pdDocument.PrintPage+=newPrintPageEventHandler(PrintDocument_PrintPage);//pdDocument.DefaultPageSettings.Landscape=true;//此处更改页面为横向打印pdDocument.Print();}intil=0;privatevoidPrintDocument_PrintPage(objectsender,PrintPageEventArgse){e.HasMorePages=true;//此处打开多页打印属性il++;//il是一个计数器,即页数Bitmapbmp=newBitmap(this.Width,this.Height);//生成一个BMP对象this.DrawToBitmap(bmp,newRectangle(Point.Empty,this.Size));//将当前界面转成BMP图片ImagePrintImage=(Image)bmp.Clone();//将BMP转换成Image对象e.Graphics.DrawImage(PrintImage,0,0);//在左上角0,0的位置打印图像if(il>9)//共打印10张e.HasMorePages=false;//关掉多页打印属性}
上面的代码是打印10张,我想设置第二张不用打印,该怎么处理有没有大神帮帮忙
时间: 2024-09-26 23:07:14