Microsoft KB Archive/57649

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 Knowledge Base

CIRCLE Statement Draws Ellipses Based on Horizontal Resolution

Article ID: 57649

APPLIES TO

• Microsoft QuickBasic 4.0
• Microsoft QuickBASIC 4.0b
• Microsoft QuickBasic 4.5 for MS-DOS
• Microsoft BASIC Compiler 6.0
• Microsoft BASIC Compiler 6.0b
• Microsoft BASIC Professional Development System 7.0
• Microsoft BASIC Professional Development System 7.1

SUMMARY

Circles and ellipses generated using the CIRCLE statement are based on the current horizontal resolution of the current coordinate system. This can result in what may appear to be incorrect circles or ellipses for the radius value given in the CIRCLE statement.

This information applies to Microsoft QuickBasic versions 4.0, 4.0b, and 4.5, to Microsoft Basic Compiler versions 6.0, 6.0b for MS-DOS, and to Microsoft Basic Professional Development System (PDS) version 7.0 and 7.1 for MS-DOS.

When an ellipse is generated using the CIRCLE statement, the ellipse will never be wider or taller than the radius value given in the CIRCLE statement using the horizontal resolution of the current coordinate system. The following code examples demonstrate this using all three possibilities, using VGA SCREEN mode 12:

```   X-resolution < Y-resolution: WINDOW(-320,-440)-(320,440)  '640x880
X-resolution = Y-resolution: WINDOW(-320,-240)-(320,240)  '640x480
X-resolution > Y-resolution: WINDOW(-620,-240)-(620,240)  '1240x480
```

Each program draws a circle using the CIRCLE statement, with a center at (0, 0) and a radius of 100. A box is then drawn using the LINE statement, with its center at (0, 0) and sides with a length of 200. In a coordinate system of one-to-one, the default in SCREEN 12, this produces a circle and a box in the center of the screen with the circle tangent to all four sides of the box. When the coordinate system is altered using a WINDOW statement, the circle always remains tangent to the left and right sides of the box, but either falls short of or exceeds the top and bottom of the box.

Code Example 1

```'*** X-resolution < Y-resolution ***
SCREEN 12
WINDOW(-320,-440)-(320,440)
CIRCLE(0, 0), 100
LINE(-100, -100)-(100, 100),,B
END
```

Code Example 2

```'*** X-resolution = Y-resolution ***
SCREEN 12
WINDOW(-320,-240)-(320,240) 'Commenting this line out gives same result
CIRCLE(0, 0), 100
LINE(-100, -100)-(100, 100),,B
END
```

Code Example 3

```'*** X-resolution > Y-resolution ***
SCREEN 12
WINDOW(-620,-440)-(620,440)
CIRCLE(0, 0), 100
LINE(-100, -100)-(100, 100),,B
END
```

Additional query words: QuickBas BasicCom 4.00 4.00b 4.50 6.00 6.00b 7.00 7.10

Keywords: KB57649