|
vb.net print to printer text from RichTextBox |
van_houtte
Member #11,605
January 2010
|
Hello, I looked around, but I can't seem to find a simple and clear answer. I have a bunch of text that has been formated and is being displayed correctly in a RichTextBox What code will print to a printer what is in the RichTextBox? Thanks ----- Sometimes you may have to send 3-4 messages |
jmasterx
Member #11,410
October 2009
|
To lead you in the right direction, if I recall correctly, the way printing works in Windows is with GDI. So basically you get a graphics context for a printer, you then do things like g.drawImage(...), etc, and paint into your context, the context is then printed by the printer. It's not the funnest thing in the world to print like this. As for printing rtf, I've never done so, you might have to manually figure out the font metrics of each word and do g.drawString or something. Good Luck This seems like a good start http://www.dreamincode.net/forums/topic/44150-printing-in-vbnet/ Agui GUI API -> https://github.com/jmasterx/Agui |
BAF
Member #2,981
December 2002
|
Your google-fu is weak. On first page of Google results. Convert to VB and you're done. |
van_houtte
Member #11,605
January 2010
|
converting from c# to vb, isnt simple to me, but I found this http://support.microsoft.com/kb/811401 it was one of the first results and it works great, i found this first but i thought there might've been a simple code such as PrintThis(RichTextbox) ----- Sometimes you may have to send 3-4 messages |
BAF
Member #2,981
December 2002
|
What's so hard about it? Your sig says you're an expert programmer, so surely you know C or C++ or C# or something similar enough to understand the gist of what's going on. .NET is .NET, so you shouldn't have any API problems - you should be able to get away with literally translating it from C# to VB. |
van_houtte
Member #11,605
January 2010
|
thanks for the input BAF, your article has helped me add more code to the KLAXXXZ GAME MAKER vb.net api ----- Sometimes you may have to send 3-4 messages |
jmasterx
Member #11,410
October 2009
|
You could always convert the code here: http://www.developerfusion.com/tools/convert/csharp-to-vb/ Agui GUI API -> https://github.com/jmasterx/Agui |
|