DRAW Statement Doesn't Affect WINDOW's Physical Coordinates (44352)






This article was previously published under Q44352

SUMMARY

The DRAW statement does not change the screen's logical coordinates, which are set using the WINDOW statement. The DRAW statement uses only physical coordinates, whereas normal graphics statements (PSET, LINE, CIRCLE) are specified with view coordinates.

While the view coordinates are not changed by the DRAW statement, the physical coordinates [returned in POINT(0) and POINT(1)] are changed by the normal graphics statements.

This information applies to QuickBasic Versions 3.00, 4.00, 4.00b, and 4.50, to Microsoft Basic Compiler 6.00 and 6.00b, and to Microsoft Basic PDS Version 7.00.

MORE INFORMATION

In the following code sample, the first CIRCLE specified with view coordinates sets the physical coordinates [returned by POINT(0) and POINT(1)] to the equivalent point (at the center of the CIRCLE). The ensuing DRAW statement draws a line from the center point to the point specified in the DRAW. This DRAW statement changes the physical coordinates [shown by the values of POINT(0) and POINT(1)] but leaves the view coordinates unchanged [POINT(2) and POINT(3)]. The second CIRCLE statement will be centered on the view coordinates of the center point of the first CIRCLE, rather than the physical coordinates of the other end of the line created with the DRAW.

Code Example

SCREEN 9
WINDOW (0, 0)-(60, 60)
CIRCLE (10, 10), 4   ' Set the 1st point Physical and view correspond

PRINT "First CIRCLE Coordinates:"
PRINT "Physical coordinates = ("; POINT(0); ","; POINT(1); ")"
PRINT "View     coordinates = ("; POINT(2); ","; POINT(3); ")"
PRINT

DRAW "M20,20"         ' DRAW line -- Physical changed; view unchanged

PRINT "DRAW Coordinates:"
PRINT "Physical coordinates = ("; POINT(0); ","; POINT(1); ")"
PRINT "View     coordinates = ("; POINT(2); ","; POINT(3); ")"
PRINT

CIRCLE STEP(0, 0), 8  ' Centers around 1st CIRCLE not far end of DRAW

PRINT "Second CIRCLE Coordinates:"
PRINT "Physical coordinates = ("; POINT(0); ","; POINT(1); ")"
PRINT "View     coordinates = ("; POINT(2); ","; POINT(3); ")"
PRINT

END
				

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: KB44352