WINDOW - QB64 Wiki


From QB64 Wiki

Jump to: navigation, search

The WINDOW graphics statement defines the coordinate dimensions of the current graphics view port or closes it.


WINDOW [[SCREEN] (column1, row1)-(column2, row2)]


  • If no statement parameters are used, the previous WINDOW view port area is disabled.
  • The SCREEN option inverts Cartesian row values to increase from negative to 0 to positive. Columns unchanged.
  • If the SCREEN option is not used, rows use the Cartesian system with highest row at top to lowest row at bottom.
  • Optional coordinate values redefine the SINGLE negative or positive port dimension values when desired.


  • The statement allows a program to create a custom graphic coordinate system independent of the SCREEN mode used.
  • WINDOW dimensions can be greater than the SCREEN mode size to create larger images for pictures.
  • A VIEW statement can change the viewport area.
  • All subsequent graphics statements will use the new coordinate system.
  • Use CLS or CLS 1 to clear the active WINDOW view port area.
  • RUN or a SCREEN statement will also disable the window viewport.
  • Note: QB64 can create a custom sized window using _NEWIMAGE.
  • Note: QB64 RUN statements will not close VIEW PRINT, VIEW or WINDOW view ports presently!

Example: Using a WINDOW to amplify circle sizes. PMAP finds the corresponding WINDOW co-ordinates.

SCREEN 12 WINDOW (0, 0)-(10, 10) 'uses Cartesian row co-ordinates PRINT "Click mouse to place a circle. Hit enter for next color." FOR clr = 1 TO 15 DO DO IF _MOUSEBUTTON(1) THEN x! = PMAP(_MOUSEX, 2) ' Convert mouse screen co-ordinates to window co-ordinates. y! = PMAP(_MOUSEY, 3) CIRCLE (x!, y!), .2, clr PAINT STEP(0, 0), clr END IF LOOP WHILE _MOUSEINPUT LOOP UNTIL INKEY$ = CHR$(13) NEXT

See also:

Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page
  • Page
  • Discussion
  • View source
  • History
Personal tools
  • Log in
  • What links here
  • Related changes
  • Special pages
  • Printable version