Solved

enlarging app screen to "full-screen"

Posted on 2002-04-21
10
332 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
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi cmd execution 6 60
add combobox item based on numbers 9 141
Strange behavior when a form is closed 6 57
Sending files from  idTcpServer Socket to idTcpClient 2 40
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

770 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