Microsoft KB Archive/150192

= FIX: X / Y Coordinates Reversed Using PSet on Printer Object =

Article ID: 150192

Article Last Modified on 7/13/2004

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q150192



SYMPTOMS
If the PSet method is invoked for the Printer object, the X and Y coordinates are reversed: the first argument represents the vertical coordinate and the second argument represents the horizontal coordinate.



RESOLUTION
Invoke the coordinates in reverse order when the PSet method is used for the Printer object.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been fixed in Visual Basic 5.0.



Steps to Reproduce Problem
  Start a new project in Visual Basic. Form1 is created by default. In the Click event of Form1, place the following code: Private Sub Form_Click Dim I As Integer

'Should print a horizontal dotted line

For I = 0 To Printer.ScaleWidth Step 100

Printer.PSet (I, (Printer.ScaleHeight \ 2))

Next

Printer.EndDoc End Sub   Run the project by pressing F5. Click on the Form, and it prints out a dotted line to the default printer. The line runs across the paper. Since the default is portrait, the line runs along the short side of the paper. However, the print job contains a line that runs along the vertical axis.

To correct the code above, the order of the arguments to the PSet method can be swapped: Printer.PSet ((Printer.ScaleHeight \ 2), I) This should only be done when the PSet is used with the Printer object. 

Keywords: kbbug kbfix kbprint kbvbp500fix KB150192

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.