Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi How to prevent window title bar height changes when app is maximized (https://www.delphipraxis.net/210915-how-prevent-window-title-bar-height-changes-when-app-maximized.html)

jimsweb 29. Jun 2022 18:43

AW: How to prevent window title bar height changes when app is maximized
 
thank you everyone.

I followed your valuable suggestions and somehow made it work.. It just works, however since we are capturing maximize action manually and setting the form size to desktop width and height, i cannot enable or display restore button.

is there a way to show restore button after the form has been expanded to cover the screen?
Is there a way to preven the form not to get expanded beyond task bar area? Currently the form gets expanded and goes under taskbar causing some of the elements to be hidden..

Code:
procedure TForm1.WMSyscommand(var Msg: TWmSysCommand);
begin
  case (Msg.cmdtype and $FFF0) of
    SC_MINIMIZE:
      begin
        // ...
      end;
    SC_RESTORE:
      begin
        // ...
      end;
    SC_MAXIMIZE:
      begin
        ShowMessage('ha Maximize');

       
        Form1.Width := screen.Width;
        Form1.Height := screen.Height;
       
        Form1.Left := 0;
        Form1.Top := 0;

        exit; // use exit if you want to cancel maximize
      end;
  end;
  inherited;

himitsu 29. Jun 2022 19:47

AW: How to prevent window title bar height changes when app is maximized
 
Zitat:

Delphi-Quellcode:
exit; // use exit if you want to cancel maximize

TWmSysCommand has a result that should be set accordingly.

and from within a form method, NEVER use the global form variable!!!!

jimsweb 30. Jun 2022 05:42

AW: How to prevent window title bar height changes when app is maximized
 
Zitat:

Zitat von himitsu (Beitrag 1508141)
Zitat:

Delphi-Quellcode:
exit; // use exit if you want to cancel maximize

TWmSysCommand has a result that should be set accordingly.

and from within a form method, NEVER use the global form variable!!!!

thank you - can you please advise on below.

is there a way to show restore button after the form has been expanded to cover the screen?
Is there a way to preven the form not to get expanded beyond task bar area? Currently the form gets expanded and goes under taskbar causing some of the elements to be hidden..

DeddyH 30. Jun 2022 07:17

AW: How to prevent window title bar height changes when app is maximized
 
Try SystemParameterInfo with SPI_GETWORKAREA as uiAction-Parameter.
Zitat:

Retrieves the size of the work area on the primary display monitor. The work area is the portion of the screen not obscured by the system taskbar or by application desktop toolbars. The pvParam parameter must point to a RECT structure that receives the coordinates of the work area, expressed in physical pixel size. Any DPI virtualization mode of the caller has no effect on this output.
To get the work area of a monitor other than the primary display monitor, call the GetMonitorInfo function.


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:54 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz