473,799 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help printing multiple fonts on printer from richtextbox

1 New Member
Hi, when I try to print from my richtextbox it's not printing what I have typed in. I want to be able to print the image that it shows. So if I type in Hello World it will print out Hello World. This goes for color too. Any help would be most appreciated. My code is below.
Thanks

-B

Imports System
Imports System.Windows. Forms
Imports System.Drawing
Imports System.Runtime. InteropServices
Imports System.Drawing. Printing
Public Class Form1

Dim checkprint As Integer
Private Sub printtext(ByVal sender As Object, ByVal ev As PrintPageEventA rgs)
ev.Graphics.Dra wString(RichTex tBox1.Text, New Font("Arial", 11, FontStyle.Regul ar), _
Brushes.Black, 120, 120)

End Sub



Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click
Dim printdoc As New PrintDocument
AddHandler printdoc.PrintP age, AddressOf Me.printtext
printdoc.Print( )

End Sub
Private Sub ChangeColorTool StripMenuItem_C lick(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles ChangeColorTool StripMenuItem.C lick
ColorDialog1.Sh owDialog()
RichTextBox1.Se lectionColor = ColorDialog1.Co lor
RichTextBox1.Fo cus()
End Sub

Private Sub ChangeFontToolS tripMenuItem_Cl ick(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles ChangeFontToolS tripMenuItem.Cl ick
FontDialog1.Sho wDialog()
RichTextBox1.Se lectionFont = FontDialog1.Fon t
RichTextBox1.Fo cus()

End Sub
End Class
Jul 8 '09 #1
0 1549

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2657
by: Val Mehling | last post by:
Up until now I have been able to avoid using Common Dialog by accessing printers directly. This is no longer possible, so- Using VB5 under XP Home Edition. I use the Common Dialog functions to select a printer and output my data. 1. If I am in the VB5 IDE, the printer output appears to be non-proportional and looks perfect because it all lines up. 2. If I am running the compiled program by itself, the printer output uses a
4
3208
by: Salad | last post by:
I'm developing an app where the print output will be on a dot-matrix printer. I suppose the printers will either be an Epson or Okidata, not really sure at this point. I, unfortunately, do not have a dot matrix anymore. Can I design my reports using TrueType fonts? Should I only use Courrier fonts? And if so, is there a recommended point size? Will page ejects work OK? Any other caveats? Thanks
16
48890
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use a commercial program such as Adobe Acrobat and its associated API. The technique uses Ghostscript and Redirection Port Monitor - two free programs for creating PDF documents provided free by Russell Lang. The actual automation requires VBA...
4
9369
by: Arif | last post by:
I C# code prints very slow as compared to a third party barcode printing software. That software prints approximately 10 labels in 2 seconds while my C# code prints 10 labels in 5 to 6 seconds. And this differences increases with the increase number of labels. The code is as follwods: Here rdr = OleDbDataReader Font is Times New Roman, 12pt
16
9380
by: Neal | last post by:
Hi, I saw the VB6 Code to do this at this link: http://www.dotnet247.com/247reference/msgs/11/56581.aspx The VB6 Code reads as follows: Private Type Rect Left As Long
2
1950
by: F. Potier | last post by:
I want to print with a small Epson ticket printer (Epson TM-T88II) As the printing is very slow with the windows fonts I'm looking for some code to make use the hardware fonts built in the printer. Can somebody help me with tis code?....
3
15037
by: Michael | last post by:
Hi, I'm trying to print barcodes to the Dymo LabelWriter printer. Put everytime I send a job to the label printer it just outputs an empty label. If I change the default printer back to the standard printer(HP LaserJet), it prints fine. Has anyone worked with Label printers like this. Here is the code I'm using: Private Sub cmdPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPrint.Click try Dim BarCode...
2
3785
by: user | last post by:
Hi all... i am trying to print an image using GDI - but the only thing i get is a black rectangle. Does anybody know what is wrong, or how else to get the bitmap on the printer (GDI+ is not possible. it is a POS printer (for restaurants) and the printer internal fonts are a MUST for printing speed. as far as i know printer internal fonts are only accessable through GDI, so all my printing is GDI up to now)
0
1236
by: Peter Duniho | last post by:
On Wed, 23 Apr 2008 09:40:14 -0700, Al Meadows <fineware@fineware.com> wrote: This doesn't really seem to be a .NET or C# question. However, you may want to look at the driver settings (printer properties). Usually when what you're describing happens, it's because the printer driver is substituting fonts that aren't built into the printer. It's more efficient for the driver to use font substitution, because then
0
9689
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9550
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10495
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10269
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10032
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2942
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.