Solved

enlarging app screen to "full-screen"

Posted on 2002-04-21
10
330 Views
Last Modified: 2010-04-04
Hi...
  I have my app currently designed to use about 75 percent of the full screen, while being positioned to the upper-left corner of the screen. I would like to make it full-screen so my file-list boxes have more room for users to view/select files.
   Is this as simple as stretching out my form (and components) during design-time to full screen? Will this account for different users using different screen resolutions? Or is there some "automatic self-adjusting" thing I must include that will adapt my app to the specific users' screen resolution, at run-time?

I am using D3 Professional

Thanks
   Shawn
0
Comment
Question by:aztec
10 Comments
 
LVL 10

Accepted Solution

by:
viktornet earned 50 total points
ID: 6958401
Hi there,

I don't remember who I got this from, but whoever it was, God bless you!

--------------------

      Here is the simple solution (but it greats): All you need just to set the scale property from main
      form to TRUE and then add this to the oncreate event of the form, maybe like this:
      procedure Tform1.Create()
      begin
       PixelsPerInch := Getdevicecaps(handle, LOGPIXELSY);
       { your code...if any}
      end;

------------

-Viktor
0
 
LVL 3

Expert Comment

by:tongalite
ID: 6958452
listening
0
 
LVL 44

Expert Comment

by:bruintje
ID: 6958553
OT > Viktor you're back that's good 2 c

for aztec


found a little nugget on the net in another forum of course :)

{
  Make your application Full Screen.
  Disable all of the system keys.
}

procedure TForm1.FormCreate(Sender: TObject);
var
  HTaskbar: HWND;
  OldVal: LongInt;
begin
  try
    // Find handle of TASKBAR
    HTaskBar := FindWindow('Shell_TrayWnd', nil);
    // Turn SYSTEM KEYS off, Only Win 95/98/ME
    SystemParametersInfo(97, Word(True), @OldVal, 0);
    // Disable the taskbar
    EnableWindow(HTaskBar, False);
    // Hide the taskbar
    ShowWindow(HTaskbar, SW_HIDE);
  finally
    with Form1 do  
    begin
      BorderStyle := bsNone;
      FormStyle   := fsStayOnTop;
      Left        := 0;
      Top         := 0;
      Height      := Screen.Height;
      Width       := Screen.Width;
    end;
  end
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
  HTaskbar: HWND;
  OldVal: LongInt;
begin
  //Find handle of TASKBAR
  HTaskBar := FindWindow('Shell_TrayWnd', nil);
  //Turn SYSTEM KEYS Back ON, Only Win 95/98/ME
  SystemParametersInfo(97, Word(False), @OldVal, 0);
  //Enable the taskbar
  EnableWindow(HTaskBar, True);
  //Show the taskbar
  ShowWindow(HTaskbar, SW_SHOW);
end;

Maybe it helps
:O)Bruintje
0
 

Author Comment

by:aztec
ID: 6958694
Bruintje - how would your approach be different (or better) than Viktornet's approach? His appears to be much simpler.

Thanks
   Shawn
0
 
LVL 5

Expert Comment

by:Gwena
ID: 6958799
listening :-)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 44

Expert Comment

by:bruintje
ID: 6958875
never said it would be better, take your pick and enjoy ;) just was looking for an execuse to make a comment
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6959351
hi friends, long time not seen, specially viktor
0
 
LVL 2

Expert Comment

by:gallaghe
ID: 6977199
The following is from an article I wrote for Delphi3000 web site.

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

procedure TfrmMainForm.FormCreate(Sender: TObject);
begin
  { Position form }
  Top := 0 ;
  Left := 0 ;

  { Go full screen }
  WindowState  := wsmaximized;
  ClientWidth  := Screen.Width ;
  ClientHeight := Screen.Height;
  Refresh;
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.

procedure TfrmMainForm.FormCreate(Sender: TObject);
begin
  { Position form }
  Top := 0 ;
  Left := 0 ;

  { Go full screen }
  BorderStyle := bsNone ;
  WindowState  := wsmaximized;
  ClientWidth  := Screen.Width ;
  ClientHeight := Screen.Height;
  Refresh;
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.

procedure TfrmMainForm.FormCreate(Sender: TObject);
begin
  { Position form }
  Top := 0 ;
  Left := 0 ;

  { Go full screen }
  BorderStyle := bsNone ;
  WindowState  := wsmaximized;
  ClientWidth  := Screen.Width ;
  ClientHeight := Screen.Height;
  Refresh;
  SetForegroundWindow(Handle) ;
  SetActiveWindow(Application.Handle) ;
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.  

The link to the article with source code
http://www.delphi3000.com/articles/article_2863.asp
0
 

Author Comment

by:aztec
ID: 7009225
Works great! Thanks!

Shawn
0
 

Author Comment

by:aztec
ID: 7068490
Sorry, but I see now that this answer by Viktornet does not work. I have just bought a new computer and I tried my app on it and it does not show the full screen. Can we re-open this question?

Thanks
   Shawn

P.S: The computer I developed my app on has screen resolution of 800 X 600. My new one I just tried it on is 1024 X 768. I would like my app to be robust enough to adapt to all different screen sizes/resolutions and be always 'full-screen'.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now