ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > N.A.N.Y. 2012

NANY 2012 Request

<< < (2/5) > >>

wraith808:
So basically, all you need is the print functionality added to the current richtextbox?

kyrathaba:
So basically, all you need is the print functionality added to the current richtextbox?
--- End quote ---

Yeah. I'd like either a user-defined control that can sit in my Toolbox and be dragged onto a Form for use, or (b) a custom class inheriting from RichTextBox that extends it, such that I can do the following:

clsExtendedRtbCtrl obj = new clsExtendedRtbCtrl();
obj.LoadFile(filepath, RichTextBoxStreamType.RichText);
obj.Print();

and, with those three lines, you get the print preview, and the ability to click OK on the print preview pane and send the RichText document to the printer. It should print any rich-text properly (italics, bold, underline, etc.), do word-wrap correctly, and print the entire contents of the rich textbox, even if it takes multiple pages.

kyrathaba:
Heh, perhaps this thread needs to be moved to Developer's Corner...

wraith808:
This isn't really a NANY, but, I posted a solution on my tech blog.  A direct link is here.

In the zip file, this is the structure

+--Libraries\External\ThinkShui.Libraries.External.csproj - the actual implementation of the extension method
|
+--PrintingTest\PrintingTest\PrintingTest.csproj - a simple example of how to use it
|
+--Bin - the assembly and the example compiled

The core of this is not original work, I just wrapped it up into two extension methods: one for when you already have the printqueue and one for when you want it to prompt, and adjusted the main code accordingly.  The URL for the source of the code is in the primary method.

Sorry for all the levels of folders; I had to extract it from something else I'm working on.  I haven't extensively tested it, so let me know if you have any questions.

kyrathaba:
Awesome, wraith! Thank you :D

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version