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();
}
打印多份的时候是不是打在同一页覆盖了? 如果是该如何声明新的页面打印? 或者如何实现一个任务打印多份? 以上代码都是在打印事件中打印图像设置多份任务
{ //读取图片 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();
}
打印多份的时候是不是打在同一页覆盖了? 如果是该如何声明新的页面打印? 或者如何实现一个任务打印多份? 以上代码都是在打印事件中打印图像设置多份任务
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货