Link to home
Start Free TrialLog in
Avatar of posnorm
posnorm

asked on

Unexpected printer color shift

My app produces a rather complicated printout involving both graphics and text. The intention is to print in black only.  I have the following two statements in my Form_Load()

Printer.ColorMode = vbPRCMMonochrome
Printer.FillColor = &H808080

When using a color printer, there is one place in the code where the printed color shifts from black to light blue for all following calls to Printer.Line

I don't know why this happens, and would appreciate any suggestions.  Here is the code fragment where it happens:

Dim A As String*1 ' A=" ", or A="-", or A= something else

For I = 1 to ILIMIT
   --- compute various X,Y coordinates
   If A = " " Then
      Printer.FillStyle = 0
      Printer.Line (XA, YA)-(XB, YB),,B
   ElseIf A = "-" Then
      Printer.FillStyle = 1
      Printer.Line (BXA,BYA)-(BXB,BYA) ' ** this statement
                               triggers the color shift!
      Printer.Line (XA, YA)-(XB, YB),,B ' ** now this prints
                               in light blue, and also all
                            other Printer.Line statements
                            as we go round the loop.
   Else
      Printer.FillStyle = 1
      Printer.Line (XA, YA)-(XB, YB),,B
   End If
Next I

ASKER CERTIFIED SOLUTION
Avatar of ackid32
ackid32

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of posnorm
posnorm

ASKER

Thank you! - Sometimes the VB printer object doesn't allow changing a property in mid-page.  Annoying.

Another solution to my problem is to specifically include vbBlack (if that's what is wanted) as:

printer.line (x1,y1)-(x2,y2), vbBlack, B

I still don't know why the color shift occurred, but as long as your suggestion (or mine) works, I'll worry about it some other time. I'd still like to know. -- Norm