FIX: X / Y Coordinates Reversed Using PSet on Printer Object
ID: Q150192
|
The information in this article applies to:
-
Microsoft Visual Basic Standard, Professional, and Enterprise Editions, 16-bit and 32-bit, for Windows, version 4.0
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.
MORE INFORMATIONSteps 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.
Additional query words:
Keywords : kbPrinting kbVBp kbVBp400bug kbVBp500fix kbGrpVB
Version :
Platform : WINDOWS
Issue type : kbbug
|