Delphi source code »

Run your Delphi application fullscreen

Here's a nice trick to run your application fullscreen.

A "normal" form doesn't cover the entire screen, but only a part of it. Of course you could maximize your form, but then it still wouldn't cover the entire screensize, because of the title bar of the window and because of Windows' taskbar.

In order to hide both the title bar and the task bar, so to make your form have the same dimensions as the screen dimensions, turn off the border of the form and then maximize it. You can do this in the form's OnCreate event. The OnCreate event-handler should look like this:

procedure TForm1.FormCreate(Sender: TObject);
  BorderStyle := bsNone;
  WindowState := wsMaximized;

Now run your application: it covers the entire screen!

But... how do you stop the program? Simply press Alt-F4. Because that's not very friendly towards the user, you'd better add a button with a caption (title) Close, that closes the form; if this is the main form (or only form), you also automatically end the program. Here's the button's OnClick event handler:

procedure TForm1.Button1Click(Sender: TObject);
Crash Course Delphi  Database Tutorials  FAQ 
Tips  Source Code  DC Library  Downloads  Links

© Copyright 1999-2018