PDA

View Full Version : Article: Automatically resize Project to user's screen size


Derek
09-22-2005, 06:26 PM
To automatically resize your project to the same size as the user's screen size, add the following lines of code to the project's "On Startup" event:

-- Get the user's screen size
screen_info = System.GetDisplayInfo();

-- set the application size to same as screen size
Window.SetSize(Application.GetWndHandle(this), screen_info.Width, screen_info.Height-10);

-- position application window to top left
Window.SetPos(Application.GetWndHandle(this), 0, 0);

You can also choose to enable 'Flat' style in the Project settings instead of 'Standard' thus effectively giving you kiosk mode without the border.
Additionally, simply subtract '10' from the height to show the taskbar:
Window.SetSize(Application.GetWndHandle(this), screen_info.Width, screen_info.Height-10);

Tek
05-15-2006, 03:34 PM
Thanks for the example.

I've been looking for a way to deal with dual monitors as well (second monitor is an extension of the first) but System.GetDisplayInfo() doesnt seem to detect that the desktop size includes the second monitor.

Any ideas on how to do this would be greatly appreciated. Basically, I want to be able to hit a button in my application and send it to the second monitor. :)