Printing Issues (Need Help Quick)


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Printing Issues (Need Help Quick)

  1. #1
    Join Date
    Jul 2005
    Posts
    9

    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

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    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!

  3. #3
    Join Date
    Jul 2005
    Posts
    9
    Quote Originally Posted by Phil Weber
    Try setting the Printer.ForeColor property.
    i have but it still prints black
    I'm a lost Kid

  4. #4
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    .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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center