PRB: Circle Aspect Ratio Unaffected by User-Defined ScaleMode (129893)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
This article was previously published under Q129893 SYMPTOMS
Lines (using the line method) drawn inside of a circle (using the Circle
method) may have different aspect ratios. Therefore, lines that should have
been an exact radius may be longer or shorter than the radius of the drawn
circle.
CAUSE
The Circle method always draws a perfect circle. It measures the radius in
the X direction. User-defined ScaleModes may have a defined unit in the X
direction that is not equal to the defined unit in the Y direction. This
causes the line lengths to be changed based on the User-defined
Scalemode, but it does not affect the circle.
RESOLUTION
This is not a problem with Visual Basic. The circle always draws a perfect
circle. It measures the radius in the X direction. The line method draws
the segments the correct length in both directions. To fix this issue, you
have to scale the Y coordinate or pick a better user-defined coordinate
system where units in the X and Y directions are equivalent. The following
shows the correct way to handle ScaleMode.
Replace the code shown in the "Steps to Reproduce Behavior" section of this
article with this code:
Sub Form_Click ()
Dim X As Integer, Y As Integer, N As Integer
N = 5
X = 0
Y = 0
yscale = Form1.ScaleWidth / Form1.ScaleHeight 'added:
Form1.ScaleMode = 0
Form1.ScaleHeight = -3
Form1.ScaleWidth = 3
Form1.ScaleLeft = -1.5
Form1.ScaleTop = 1.5
Circle (x, y), 1, QBColor(n)
Line (x, y)-(1, 0), QBColor(n)
Line (x, y)-(0, 1 * yscale), QBColor(n) 'modified: added * yscale
Line (x, y)-(-1, 0), QBColor(n)
Line (x, y)-(0, -1 * yscale), QBColor(n) 'modified: added * yscale
End Sub
STATUS
This behavior is by design.
Modification Type: | Minor | Last Reviewed: | 1/8/2003 |
---|
Keywords: | kbprb KB129893 |
---|
|