Mehmet
Mehmet

Reputation: 2288

print winform screen

I have c# winform application.

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

Capture screen is not the solution for me because my form has scroll.

How can I do this?

Thanks.

Upvotes: 0

Views: 2477

Answers (3)

Hans Passant
Hans Passant

Reputation: 941635

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.

Upvotes: 2

Javed Akram
Javed Akram

Reputation: 15344

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...

Upvotes: 2

Saeed Amiri
Saeed Amiri

Reputation: 22555

A simple google search:

Upvotes: 3

Related Questions