CONSOLE GET SIZE statement

Purpose

Retrieve the size of the console window, in pixels.

Syntax

CONSOLE GET SIZE TO nWidth&, nHeight&

Remarks

This statement can be especially useful together with CONSOLE GET LOC and GRAPHIC WINDOW, for exact positioning of graphic windows relative to the position and size of the console window.

See also

CONSOLE GET LOC, CONSOLE GET SCREEN, CONSOLE GET VIEW, CONSOLE GET VIRTUAL, CONSOLE SET LOC, CONSOLE SET SCREEN, CONSOLE SET VIEW, CONSOLE SET VIRTUAL

Example

FUNCTION PBMAIN () AS LONG

 ' Center a graphic window within a console window

  LOCAL x, y, w, h AS LONG, hWin AS DWORD

  CONSOLE GET LOC TO x, y    ' Console pos on screen

  CONSOLE GET SIZE TO w, h   ' Console size

  x = x + (w - 200) / 2      ' Calculate center x pos

  y = y + (h - 200) / 2      ' Calculate center y pos

  GRAPHIC WINDOW "Box", x, y, 200, 200 TO hWin

  GRAPHIC ATTACH hWin, 0

  GRAPHIC BOX (10, 10) - (190, 190), 0, %RED

  SLEEP 5000  ' show it for 5 seconds, then end

END FUNCTION