Link to home
Start Free TrialLog in
Avatar of aztec
aztec

asked on

enlarging app screen to "full-screen"

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
ASKER CERTIFIED SOLUTION
Avatar of viktornet
viktornet
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tongalite
tongalite

listening
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
Avatar of aztec

ASKER

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

Thanks
   Shawn
listening :-)
never said it would be better, take your pick and enjoy ;) just was looking for an execuse to make a comment
Avatar of kretzschmar
hi friends, long time not seen, specially viktor
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
Avatar of aztec

ASKER

Works great! Thanks!

Shawn
Avatar of aztec

ASKER

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'.