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
VCL-Forms
Language
Delphi 3.x
Views
188
User Rating
5
# Votes
1
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;
13  
14  if this is a typical form it will have borders which you might consider removing by 
15  setting BorderStyle property to bsNone as shown below. 
16  
17  procedure TfrmMainForm.FormCreate(Sender: TObject);
18  begin
19    { Position form }
20    Top := 0;
21    Left := 0;
22  
23    { Go full screen }
24    BorderStyle := bsNone;
25    WindowState := wsmaximized;
26    ClientWidth := Screen.Width;
27    ClientHeight := Screen.Height;
28    Refresh;
29  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. 

30  procedure TfrmMainForm.FormCreate(Sender: TObject);
31  begin
32    { Position form }
33    Top := 0;
34    Left := 0;
35  
36    { Go full screen }
37    BorderStyle := bsNone;
38    WindowState := wsmaximized;
39    ClientWidth := Screen.Width;
40    ClientHeight := Screen.Height;
41    Refresh;
42    SetForegroundWindow(Handle);
43    SetActiveWindow(Application.Handle);
44  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). 


Component Download: 

			
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