开发者

print winform screen

I have c# winform application.

I want to print all form objects, labels,textboxes etc..

Capture screen is not the solution 开发者_如何学Cfor me because my form has scroll.

How can I do this?

Thanks.


A simple google search:

  • http://msdn.microsoft.com/en-us/library/aa287529%28VS.71%29.aspx


This just doesn't work. It is pretty inappropriate anyway, the resolution of the printer is much better than the resolution of your screen. The screenshot looks very ugly on paper, especially text gets blobby with the anti-aliasing pixels becoming painfully obvious.

Bite the bullet and drop the PrintDocument component on the form. You typically need to write a fair amount of code in the PrintPage event handler. But it isn't hard code and it will look great and you can make it look just the way you want it. Be sure to make it look like a report, not a screenshot. Use PrintPreviewDialog to avoid wasting a lot of paper. Report generators like RDLC and Crystal Reports are common solutions as well.


try this it will make a bitmap of your form `

 Bitmap b = new Bitmap(this.Bounds.Width, this.Bounds.Height);
 this.DrawToBitmap(b, new Rectangle(0,0,this.Width,this.Height));
 b.Save("C:\\a.bmp");`

by this image you can print also rather than saving it...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜