Welcome to WindowsClient.net | Sign in | Join

Here are some frequently asked questions about Windows Forms and their answers.

Windows Forms FAQs

How do I print rich text from a RichTextBox?

There is no direct support for printing rich text in the .NET Framework. To print it, you can use interop with the SendMessage API and these three messages to do your printing.

EM_SETTARGETDEVICE : specify the target device

EM_FORMATRANGE : format part of a rich edit control's contents for a specific device

EM_DISPLAYBAND : send the output to the device

The MSDN article Getting WYSIWYG Print Results from a .NET RichTextBox by Martin Mller implements this solution.

Contributed from George Shepherd's Windows Forms FAQ



Page view counter