求大神帮看一段批量打印的代码(有点问题)

kudiao119 2013-02-14 05:50:49
 if (i < Form1.Pimages.Count  - 1)
{

//读取图片

Image Ptemp = (Bitmap)Image.FromFile(Form1.Pimages[i]);

if (Print.docToPrint.DefaultPageSettings.Landscape == false)
{
if (Ptemp.Width > Ptemp.Height)
{
Ptemp = Angle((Bitmap)Ptemp, 90);
}
}
else
{
if (Ptemp.Width < Ptemp.Height)
{
Ptemp = Angle((Bitmap)Ptemp, 90);
}
}


Picsize = FitSize((long)(((double)Ptemp.Width / Print.DPI) * 100), (long)(((double)Ptemp.Height / Print.DPI) * 100), e.PageBounds.Size.Width, e.PageBounds.Size.Height);
TempXY = PointXY(Picsize, e.PageBounds.Size.Width, e.PageBounds.Size.Height);
for (int t = 0; t < Print.docToPrint.PrinterSettings.Copies; t++)
{
e.Graphics.Clear(Color.Transparent);
e.Graphics.DrawImage(Ptemp, TempXY.X, TempXY.Y, (int)(((double)Ptemp.Width / Print.DPI) * 100 * Picsize.fitsize), (int)(((double)Ptemp.Height / Print.DPI) * 100 * Picsize.fitsize));
e.HasMorePages = true;


}
e.Graphics.Clear(Color.Transparent);
e.Graphics.DrawImage(Ptemp, TempXY.X, TempXY.Y, (int)(((double)Ptemp.Width / Print.DPI) * 100 * Picsize.fitsize), (int)(((double)Ptemp.Height / Print.DPI) * 100 * Picsize.fitsize));
e.HasMorePages = false;
Ptemp.Dispose();

i++;
}
else if (i == Form1.Pimages.Count - 1)
{

Image Ptemp = (Bitmap)Image.FromFile(Form1.Pimages[i]);

if (Print.docToPrint.DefaultPageSettings.Landscape == false)
{
if (Ptemp.Width > Ptemp.Height)
{
Ptemp = Angle((Bitmap)Ptemp, 90);
}
}
else
{
if (Ptemp.Width < Ptemp.Height)
{
Ptemp = Angle((Bitmap)Ptemp, 90);
}
}

Picsize = FitSize((long)(((double)Ptemp.Width / Print.DPI) * 100), (long)(((double)Ptemp.Height / Print.DPI) * 100), e.PageBounds.Size.Width, e.PageBounds.Size.Height);
TempXY = PointXY(Picsize, e.PageBounds.Size.Width, e.PageBounds.Size.Height);
for (int t = 1; t < Print.docToPrint.PrinterSettings.Copies; t++)
{
e.Graphics.Clear(Color.Transparent);
e.Graphics.DrawImage(Ptemp, TempXY.X, TempXY.Y, (int)(((double)Ptemp.Width / Print.DPI) * 100 * Picsize.fitsize), (int)(((double)Ptemp.Height / Print.DPI) * 100 * Picsize.fitsize));
e.HasMorePages = true;
//Ptemp.Dispose();
}
e.Graphics.Clear(Color.Transparent);
e.Graphics.DrawImage(Ptemp, TempXY.X, TempXY.Y, (int)(((double)Ptemp.Width / Print.DPI) * 100 * Picsize.fitsize), (int)(((double)Ptemp.Height / Print.DPI) * 100 * Picsize.fitsize));
e.HasMorePages = false;
Ptemp.Dispose();


}
else
{

}
}

我想问我在
for (int t = 1; t < Print.docToPrint.PrinterSettings.Copies; t++)
{
e.Graphics.Clear(Color.Transparent);
e.Graphics.DrawImage(Ptemp, TempXY.X, TempXY.Y, (int)(((double)Ptemp.Width / Print.DPI) * 100 * Picsize.fitsize), (int)(((double)Ptemp.Height / Print.DPI) * 100 * Picsize.fitsize));
e.HasMorePages = true;
//Ptemp.Dispose();
}
打印多份的时候是不是打在同一页覆盖了? 如果是该如何声明新的页面打印? 或者如何实现一个任务打印多份? 以上代码都是在打印事件中
...全文
203 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
kudiao119 2013-02-18
  • 打赏
  • 举报
回复
引用 3 楼 Mackz 的回复:
打印份数不是打印机的事儿么,代码不用处理。
设置不好用
菜牛 2013-02-16
  • 打赏
  • 举报
回复
打印份数不是打印机的事儿么,代码不用处理。
kudiao119 2013-02-16
  • 打赏
  • 举报
回复
我去了 好几天了。。。没高手给看下么
kudiao119 2013-02-14
  • 打赏
  • 举报
回复
没人给看看么??????????

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧