-
Printing Issues (Need Help Quick)
hey, im trying to print out text in a textbox and im trying to get the colors black,red,green + blue but i got no idea how it can be done. can someone help me.
This is my source code in case you need it to understand:
Private Sub cmdPrint_Click()
Dim msgprompt As String, msgtitle As String 'the check if the user wants to print
Dim msgButtons As Integer, msgresult As Integer
msgprompt = "Are you sure you want to print the text?"
msgButtons = vbYesNo + vbInformation + vbDefaultButton2
msgtitle = "Printing Text"
msgresult = MsgBox(msgprompt, msgButtons, msgtitle)
Select Case msgresult
Case vbYes ' if user wants to print
With Printer
.FontName = "MS Sans Serif" 'sets font
If num >= 8 Then
.FontSize = num 'sets font size
Else
.FontSize = 12 'default font size
End If
If chkBold.value = 1 Then 'checks the bold setting if its turned on
.FontBold = True
Else
.FontBold = False
End If
If chkItalic.value = 1 Then 'checks the italic setting if its turned on
.FontItalic = True
Else
.FontItalic = False
End If
If chkStr.value = 1 Then 'checks the Strikethu setting if its turned on
.FontStrikethru = True
Else
.FontStrikethru = False
End If
If chkUnder.value = 1 Then 'checks the underline setting if its turned on
.FontUnderline = True
Else
.FontUnderline = False
End If
If chkBlack.value = 1 Then 'prints out the font of user's choosing
.ColorMode = RGB(0, 0, 0)
End If
If chkRed.value = 1 Then 'prints out the font of user's choosing
.ColorMode = 2
End If
If chkBlue.value = 1 Then 'prints out the font of user's choosing
.ColorMode = RGB(21, 7, 151)
End If
If chkGreen.value = 1 Then 'prints out the font of user's choosing
.ColorMode = RGB(20, 124, 62)
End If
End With
Printer.Print txtInput.Text
Printer.EndDoc
Case vbNo
Exit Sub 'if user does not want to print then nothing will happen
End Select
End Sub
-
Try setting the Printer.ForeColor property.
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
 Originally Posted by Phil Weber
Try setting the Printer.ForeColor property.
i have but it still prints black
 I'm a lost Kid 
-
.ForeColor followed by .Print works fine with me, but you are not using the ColorMode property correctly. It is an integer: 1 (VbPRCMMonochrome, print b/w only) or 2 (VbPRCMColor: print in color)
Marco
"There are two ways to write error-free programs. Only the third one works."
Unknown
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks