-
Jul 8th, 2017, 12:09 PM
#1
Thread Starter
Lively Member
Preview/Printing RichTextBox in Color w/Images
Hi,
My understanding is that you cannot print the contents of RichTextBox when it has RTF Formatting applied to the PrintPreview dialog or control natively without actually parsing the entire string... which is ridiculous.
However, Microsoft has an article on how to do this by wrapping the RichTextBox in DLL/Control.
SEE HERE: https://support.microsoft.com/EN-US/help/811401
This DLL/Control uses the EM_FORMATRANGE winapi
I know some of you didn't want to compile this yourself
So, I went ahead and did this so you don't have too.
If you don't want to use the DLL (which is included in ZIP file.... you can use the Class internally in your app instead)
How this example works...
1) This example code loads an external RTF file
2) You have several options to display the RTF file on a PrintPreviewDialog, Print directly or on PrintPreviewControl
Screenshot:
I have included both source (dll and sample project) files....
RichTextDLL_PrintPreview.zip
RichTextBoxPrintCtrl.zip
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|