c#如何设置打印的页数?比如我要把把这一页打印10张如何加代码? 10
我的代码如下,怎么加进去打印的页数?privatevoidbutton1_Click(objectsender,EventArgse){Graphicsgraphic=P...
我的代码如下,怎么加进去打印的页数?
private void button1_Click(object sender, EventArgs e)
{
Graphics graphic = Panel.CreateGraphics();
Size s = Panel.Size;
Image image = new Bitmap(s.Width, s.Height, graphic);
Graphics graphic1 = Graphics.FromImage(image);
IntPtr dc1 = graphic.GetHdc();
IntPtr dc2 = graphic1 .GetHdc();
BitBlt(dc2, 0, 0, panel.ClientRectangle.Width, panel.ClientRectangle.Height,dc1, 0, 0, 13369376);
Image print_image = (Image)image.Clone();
graphic.ReleaseHdc(dc1);
graphic1.ReleaseHdc(dc2);
graphic.Dispose();
graphic1.Dispose();
PrintPreviewDialog dlg = new PrintPreviewDialog();
dlg.Width = 800;
dlg.Height = 600;
dlg.Document = reportDocument1;
if (dlg.ShowDialog() == DialogResult.OK)
reportDocument1.Print();
} 展开
private void button1_Click(object sender, EventArgs e)
{
Graphics graphic = Panel.CreateGraphics();
Size s = Panel.Size;
Image image = new Bitmap(s.Width, s.Height, graphic);
Graphics graphic1 = Graphics.FromImage(image);
IntPtr dc1 = graphic.GetHdc();
IntPtr dc2 = graphic1 .GetHdc();
BitBlt(dc2, 0, 0, panel.ClientRectangle.Width, panel.ClientRectangle.Height,dc1, 0, 0, 13369376);
Image print_image = (Image)image.Clone();
graphic.ReleaseHdc(dc1);
graphic1.ReleaseHdc(dc2);
graphic.Dispose();
graphic1.Dispose();
PrintPreviewDialog dlg = new PrintPreviewDialog();
dlg.Width = 800;
dlg.Height = 600;
dlg.Document = reportDocument1;
if (dlg.ShowDialog() == DialogResult.OK)
reportDocument1.Print();
} 展开
展开全部
PrintPreviewDialog dlg = new PrintPreviewDialog();
dlg.Width = 800;
dlg.Height = 600;
dlg.Document = reportDocument1;
dlg.Document.Copies = 10; // 打印 10 份(获取或设置打印的份数)
if(dlg.ShowDialog() == DialogResult.OK)
dlg.Print(); // (此处有修改)用 dlg 对象进行打印。
// reportDocument1 对象,是 VS 自带的水晶报表(CrystalDecisions.CrystalReports.Engine.ReportDocument)吗?好像没有 Print 方法吧?
dlg.Width = 800;
dlg.Height = 600;
dlg.Document = reportDocument1;
dlg.Document.Copies = 10; // 打印 10 份(获取或设置打印的份数)
if(dlg.ShowDialog() == DialogResult.OK)
dlg.Print(); // (此处有修改)用 dlg 对象进行打印。
// reportDocument1 对象,是 VS 自带的水晶报表(CrystalDecisions.CrystalReports.Engine.ReportDocument)吗?好像没有 Print 方法吧?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询