我想在当前代码中以大尺寸从图片框打印图像,以原始尺寸打印图像,我尝试了以下代码:
private void btnID_Click(object sender, EventArgs e)
{
PrintDialog pd = new PrintDialog();
PrintDocument pdoc = new PrintDocument();
pdoc.PrintPage += doc_printID;
pd.Document = pdoc;
if (pd.ShowDialog() == DialogResult.OK)
pdoc.Print();
}
private void doc_printID(object sender, PrintPageEventArgs e)
{
Bitmap bm = new Bitmap(pictureIDIQAMA.Width, pictureIDIQAMA.Height);
pictureIDIQAMA.DrawToBitmap(bm, new Rectangle(0, 0, pictureIDIQAMA.Width, pictureIDIQAMA.Height));
e.Graphics.DrawImage(bm, 200,400);
bm.Dispose();
}
如何以两倍的原始尺寸打印更大尺寸的图像?
绘制页面边缘的图像
e.Graphics.DrawImage(bm, args.MarginBounds);
或
在整个页面上绘制图像
e.Graphics.DrawImage(bm, args.PageBounds);