#include "graphics.h" bool isresizeevent( );
Once this event has been detected, the program can redraw the screen if necessary, using the getmaxx and getmaxy functions to determine the new size of the screen. Afterward, the program should call clearresizeevent so that the isresizeevent function doesn't continue to return true.
Note: For information on how to create a window that the user can resize, please see the documentation for the final argument of initwindow.
/* resize example */ #include "graphics.h" void main(void) { int maxx, maxy; // Maximum x and y pixel coordinates int x, y; // Coordinates of the mouse click int divisor; // Divisor for the length of a triangle side // Put the machine into graphics mode and get the maximum coordinates: initwindow(450, 300, "", 600, 200, false, false, WS_POPUP|WS_THICKFRAME); maxx = getmaxx( ); maxy = getmaxy( ); cout << "WIDTH: " << getmaxx( )+1 << endl; cout << "HEIGHT: " << getmaxy( )+1 << endl; do { clearviewport( ); line(0, 0, getmaxx( ), getmaxxy( )); while (!isresizeevent( ) & !kbhit( )) { delay(1000); } clearresizeevent( ); } while (!kbhit( )); // Switch back to text mode: closegraph( ); }