Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to Display forms full screen Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
22-Jun-03
Category
Others
Language
Delphi 3.x
Views
136
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Kevin Gallagher

How can I show a form so that it covers all available screen space including the 
taskbar?

Answer:

Covering the entire screen with a form is relatively easy to accomplish as shown 
below. 

1   procedure TfrmMainForm.FormCreate(Sender: TObject);
2   begin
3     { Position form }
4     Top := 0;
5     Left := 0;
6   
7     { Go full screen }
8     WindowState := wsmaximized;
9     ClientWidth := Screen.Width;
10    ClientHeight := Screen.Height;
11    Refresh;
12  end;


If this is a typical form it will have borders which you might consider removing by 
setting BorderStyle property to bsNone as shown below. 

13  procedure TfrmMainForm.FormCreate(Sender: TObject);
14  begin
15    { Position form }
16    Top := 0;
17    Left := 0;
18  
19    { Go full screen }
20    BorderStyle := bsNone;
21    WindowState := wsmaximized;
22    ClientWidth := Screen.Width;
23    ClientHeight := Screen.Height;
24    Refresh;
25  end;


Sometimes the code shown above will go full screen but still display the Windows 
TaskBar, if this happens we can force the form on top using either 
SetForeGroundWindow or SetActiveWindow. From my testing it is best to use both if 
the problem persist. 

26  procedure TfrmMainForm.FormCreate(Sender: TObject);
27  begin
28    { Position form }
29    Top := 0;
30    Left := 0;
31  
32    { Go full screen }
33    BorderStyle := bsNone;
34    WindowState := wsmaximized;
35    ClientWidth := Screen.Width;
36    ClientHeight := Screen.Height;
37    Refresh;
38    SetForegroundWindow(Handle);
39    SetActiveWindow(Application.Handle);
40  end;


Other  considerations (see attachment for code to address these items) If the form 
is already in maximized window state the above code will not work. Controlling the 
system menu commands as per above needs to be considered Ghost items in the TaskBar 
after terminating your application.   

Delphi makes it simple to cover the display screen but what if you need to 
duplicate the functionality in another programming language such as Microsoft 
Visual Basic? Well in this case you might want to learn the API methods (again see 
attachment). 



			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC