从printdocument打印图像 [英] printing an image from printdocument
本文介绍了从printdocument打印图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的朋友,
在我的win窗体应用程序中,我想一次预览和打印许多图像.
因此,我将imageList用于多个图像,将printDocument和printPreviewDialog用于预览和打印.
我的代码如下:
Dear friends,
In my win form application i want to preview and print number of images at a time.
So i used a imageList for multiple images and a printDocument and a printPreviewDialog for preview and printing.
My code is as follows :
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Image i = imageList1.Images[1];
e.Graphics.DrawImage(i, 100, 50,i.Width, i.Height);
}
但是当它永远不会占用原始图像的高度和宽度时.它减少了我图像的高度和宽度.
我怎么解决这个问题.我想保留图像的原始高度和宽度.
在此先感谢.
Shailesh.
:-)
but when it never takes the original image height and width. It reduces the height and width of my image.
How can i solve this problem. I want to retain the original height and width of my image.
Thanks in Advance.
Shailesh.
:-)
推荐答案
查看此内容: ^ ]
图片的原始"尺寸是多少?两者都有分辨率.您可能会以原始大小(以像素为单位)获得图像.我想您的图像分辨率与打印机的分辨率不匹配.顺便说一下,打印机的X和Y分辨率在每种情况下都不相同.因此,您可以考虑英寸而不是像素,然后重新计算大小.
See this one: http://www.morgadinho.org/2007/02/27/c-printing-an-image-file/[^]
What is the "original" size of an image? Both have resolution. You probably get the image in it''s original size in pixels. I suppose, your image''s resolution does not match that of the printer. And by the way a printer''s X and Y resolution is not the same in every case. Thus you have tho think in inches not in pixels, and recalculate the size.
您提供了非常短的代码示例.但是,我假设您需要预览一些图像然后再打印.看到这一点,有很多方便的图像处理命令,包括预览,打印图像,打印批处理等: http://www.artuxsoft. com/.
You provided very short code samples. However, I assume that you need to preview some images and then print them. See this one, there are a lot of convinient image processing commands including preview, print image, print batch and so on: http://www.artuxsoft.com/.
这篇关于从printdocument打印图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文