Welcome Guest.   Make a donation to an author on the site October 30, 2014, 07:16:24 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2013! Download dozens of custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: NANY 2012 Request  (Read 6868 times)
kyrathaba
N.A.N.Y. Organizer
Moderator
*****
Posts: 3,012



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« on: December 12, 2011, 07:20:05 AM »

Not really an app request, but rather a component request, and perhaps there's a free version of this out there in cyberspace somewhere, but if so I haven't come across it:

I would like a custom control that I can add to my Visual C# Express toolbox. It should inherit from RichTextBox, but should be able to LoadFile() just like a RichTextBox (plain or RTB format), and should have a Print() method that prints the entire contents of the custom Rich TextBox.

Printing is abominably arcane in .NET!  Grrr...
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

lotusrootstarch
Member
**
Posts: 160



People reckon I'll smash into Cody someday.

View Profile Give some DonationCredits to this forum member
« Reply #1 on: December 12, 2011, 07:23:37 AM »

does this help?

http://msdn.microsoft.com...-us/library/aa970917.aspx
Logged

Get my apps in Android Market! Go droids go! smiley

kyrathaba
N.A.N.Y. Organizer
Moderator
*****
Posts: 3,012



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: December 12, 2011, 08:15:43 AM »

Thanks, lotus.  There are lots of useful articles such as that one. But all are quite involved. I just can't believe that someone hasn't made a simple drop-in custom control such that, if the Rich Text Box contains text, you can just invoke Print() to print all the text it contains.

I've figured out a way to print simple text files in their entirety, but I'm not finding a pre-made free control for doing the same with RichTextBox. There's plenty of code samples for rolling-your-own.
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

hollowlife1987
Honorary Member
**
Posts: 88


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #3 on: December 12, 2011, 08:20:09 AM »

How about an Extension Method?

http://msdn.microsoft.com...-us/library/bb383977.aspx
Logged
kyrathaba
N.A.N.Y. Organizer
Moderator
*****
Posts: 3,012



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #4 on: December 12, 2011, 07:14:17 PM »

Hmm, thank you for that link, hollowlife; it appears worthy of study...
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

wraith808
Supporting Member
**
Posts: 6,445



"In my dreams, I always do it right."

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: December 12, 2011, 07:57:07 PM »

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

kyrathaba
N.A.N.Y. Organizer
Moderator
*****
Posts: 3,012



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: December 12, 2011, 08:57:09 PM »

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

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

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

kyrathaba
N.A.N.Y. Organizer
Moderator
*****
Posts: 3,012



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #7 on: December 12, 2011, 08:59:17 PM »

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

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

wraith808
Supporting Member
**
Posts: 6,445



"In my dreams, I always do it right."

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #8 on: December 12, 2011, 11:00:38 PM »

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.
« Last Edit: December 13, 2011, 07:17:20 AM by wraith808 » Logged

kyrathaba
N.A.N.Y. Organizer
Moderator
*****
Posts: 3,012



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #9 on: December 13, 2011, 06:38:45 AM »

Awesome, wraith! Thank you cheesy
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

kyrathaba
N.A.N.Y. Organizer
Moderator
*****
Posts: 3,012



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #10 on: December 13, 2011, 06:40:07 AM »

Hmm...

Quote
http://thinkshui.net/2011...rinting-from-richtextbox/...

Firefox can't find the server at thinkshui.net.
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

Ath
Supporting Member
**
Posts: 2,240



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #11 on: December 13, 2011, 07:00:06 AM »

Just opened that page using FF 8 cheesy
Logged

Ath
Supporting Member
**
Posts: 2,240



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #12 on: December 13, 2011, 07:03:38 AM »

But the downloaded file can't be read by 7-zip Sad
Logged

wraith808
Supporting Member
**
Posts: 6,445



"In my dreams, I always do it right."

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #13 on: December 13, 2011, 07:12:18 AM »

But the downloaded file can't be read by 7-zip Sad

Eh?  It should be able to be read, considering that I made it with 7-zip.  Let me try again.  And try again on the page (or the download).  I'm just getting everything together on the site, so there may be a few quirks.  (Trying to separate my gaming from my development stuff)

...that's strange.  I downloaded it and opened it with 7-zip and it opened fine and I was able to browse it.  I re-compressed it and uploaded it again.  Let me know if you still have problems.
Logged

hollowlife1987
Honorary Member
**
Posts: 88


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #14 on: December 13, 2011, 07:14:19 AM »

I was able to extract with 7zip and WinRAR, as for download URL, i noticed you posted the URL using all lowercase letters. I was able to download by changing the file name to RTFPrinting.zip in the URL
Logged
wraith808
Supporting Member
**
Posts: 6,445



"In my dreams, I always do it right."

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #15 on: December 13, 2011, 07:16:55 AM »

I was able to extract with 7zip and WinRAR, as for download URL, i noticed you posted the URL using all lowercase letters. I was able to download by changing the file name to RTFPrinting.zip in the URL

Whoops!  I'll update.
Logged

Ath
Supporting Member
**
Posts: 2,240



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #16 on: December 13, 2011, 07:25:56 AM »

Using the instructions of Hollow I've successfully downloaded and opened the file thumbs up
Logged

kyrathaba
N.A.N.Y. Organizer
Moderator
*****
Posts: 3,012



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #17 on: December 14, 2011, 07:13:05 AM »

Hmm, I tried hollowlife's renaming, downloaded the file, but wasn't able to open it:

Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

kyrathaba
N.A.N.Y. Organizer
Moderator
*****
Posts: 3,012



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #18 on: December 14, 2011, 07:18:19 AM »

Also unable to open it with 7-zip.  huh
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

skwire
Global Moderator
*****
Posts: 4,119



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #19 on: December 14, 2011, 07:45:38 AM »

For what it's worth, I'm able to download it and extract it with both WinRAR (v3.91) and 7-zip (v4.65), no problem.
Logged

Ath
Supporting Member
**
Posts: 2,240



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #20 on: December 14, 2011, 08:14:13 AM »

Hmm, I tried hollowlife's renaming,
in the URL
These last 3 words are crucial in the description of getting it to work...
Logged

wraith808
Supporting Member
**
Posts: 6,445



"In my dreams, I always do it right."

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #21 on: December 14, 2011, 08:56:12 AM »

I fixed the URL problem in the direct download, and it works on the site, so that shouldn't be a problem.  As far as the not being able to open it in 7-zip, that's still strange, as I compressed it with 7-zip.  Also attaching it in this post (didn't do that before for the sake of changes to the code... but maybe that will work for you?)

* RTFPrinting.zip (54.9 KB - downloaded 84 times.)
Logged

Ath
Supporting Member
**
Posts: 2,240



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #22 on: December 14, 2011, 09:40:13 AM »

Wraith, the link on your Blog is dodgy, it points to the zipfile with all lowercase letters, as hollowlife pointed out. Clicking the link gives me a 404 error-page.
If I right-click and select download, I (slowly) get a file of about 20 kB, but I can't open it. When copying the link text and changing the name into the correct case (using a new tab in my browser), it downloads fine and can be opened as expected.

The direct link in your #8 reply here works fine now, as does the attached download.
Logged

wraith808
Supporting Member
**
Posts: 6,445



"In my dreams, I always do it right."

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #23 on: December 14, 2011, 10:16:57 AM »

Ah... thanks!  I didn't know I'd messed up on the one on the blog post itself also!  That one is corrected, also.  Now I know why I usually make my file names all lower case!  Grin

Thanks again for pointing that out!
Logged

kyrathaba
N.A.N.Y. Organizer
Moderator
*****
Posts: 3,012



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #24 on: December 30, 2011, 07:59:00 PM »

wraith, thanks again for your work on this: with your help, I figured out how to make printing work in my Prayer Minder app. Much obliged!
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.044s | Server load: 0.12 ]