How can I print a Form?

  • Thread starter Thread starter Maxwell2006
  • Start date Start date
Hi,

Assuming this is a Windows Form, take a screenshot of the form
(Alt+PrintScreen), and then paste it into any Image editor application
(even MS PaintBrush). Then save or print it out.

HTH,

Regards,

Cerebrus.
 
Sorry I didn't clearly explain the question.

How can I print a WinForms by using C# code.

I am looking to have a button in my form and after pressing the button, the
form and it's data get printed. The form might contain scrollable ritch text
boxes.

Thank you,
Max
 
Hi Max,

Thanks for your feedback.

To programmatically capture a screen shoot of the form, we can p/invoke
Win32 BitBlt API. Please refer to "How do I capture a bitmap of a form?"
topic from the link below:
http://msdn.microsoft.com/smartclient/community/wffaq/default.aspx

Below is a VB.net sample:
"Code: Printing a Windows Form (Visual Basic)"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vbcode/h
tml/vbtskCodeExamplePrintingForm.asp

Hope this helps!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top