AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi How to prevent window title bar height changes when app is maximized

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

Ein Thema von jimsweb · begonnen am 29. Jun 2022 · letzter Beitrag vom 30. Jun 2022
Antwort Antwort
Benutzerbild von haentschman
haentschman

Registriert seit: 24. Okt 2006
Ort: Seifhennersdorf / Sachsen
5.436 Beiträge
 
Delphi 12 Athens
 
#1

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

  Alt 29. Jun 2022, 06:16
Hi...

Welcome...
This forum is in german language...
There are an english Version of the DelphiPraxis. https://en.delphipraxis.net
There you will be better helped...because they understand you.

  Mit Zitat antworten Zitat
Benutzerbild von Sinspin
Sinspin
Online

Registriert seit: 15. Sep 2008
Ort: Dubai
717 Beiträge
 
Delphi 10.3 Rio
 
#2

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

  Alt 29. Jun 2022, 07:55
Hey,

I don't think that you can prevent that, it's a Windows behaviour.
If you look for a workaround, one solution would be to align your client area to top or the bottom of the form to make sure the gap is not interfering. (Top align is the default behaviour)
Or, you draw the whole content by yourself, inclusive the window title bar.
Stefan
Nur die Besten sterben jung
A constant is a constant until it change.
  Mit Zitat antworten Zitat
Der schöne Günther

Registriert seit: 6. Mär 2013
6.199 Beiträge
 
Delphi 10 Seattle Enterprise
 
#3

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

  Alt 29. Jun 2022, 09:33
Microsoft Teams is a good example - The electron app paints the title bar entirely by itself, and its size doesn't change, no matter if the window is maximized or not. It looks entirely out of place, I hate it with a passion.

Visual Studio Code is exactly the same, but at least it doesn't look like a children's playground.
  Mit Zitat antworten Zitat
jimsweb

Registriert seit: 30. Mai 2013
5 Beiträge
 
#4

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

  Alt 29. Jun 2022, 14:59
Hey,

I don't think that you can prevent that, it's a Windows behavior.
If you look for a workaround, one solution would be to align your client area to top or the bottom of the form to make sure the gap is not interfering. (Top align is the default behavior)
Or, you draw the whole content by yourself, inclusive the window title bar.
I apologize for not following this - how do I manually align client area to maintain the titlebar height? Can you please elaborate?
  Mit Zitat antworten Zitat
Benutzerbild von haentschman
haentschman

Registriert seit: 24. Okt 2006
Ort: Seifhennersdorf / Sachsen
5.436 Beiträge
 
Delphi 12 Athens
 
#5

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

  Alt 29. Jun 2022, 15:41
You don't need to apologize....
Zitat:
but when i try to use my existing credentials, it doesn't allow me to login not sure how can i fix this..

I think, you schould write a PM to @Daniel (Admin) ... he can help you.

  Mit Zitat antworten Zitat
Benutzerbild von Sinspin
Sinspin
Online

Registriert seit: 15. Sep 2008
Ort: Dubai
717 Beiträge
 
Delphi 10.3 Rio
 
#6

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

  Alt 29. Jun 2022, 15:58
The idea was just to ignore the size change and make sure the client area stays at the same location. But, that idea went too short for been practicable
However, maybe would it be a better solution to wait until the program gets maximized,
then capture the form location and size, set the WindowState of the form back to normal and set the window location and size by youself.
Then will the title bar not change in size.
Stefan
Nur die Besten sterben jung
A constant is a constant until it change.
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.375 Beiträge
 
Delphi 12 Athens
 
#7

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

  Alt 29. Jun 2022, 16:15
You could catch the WM_MAXIMIZE event and not let your program maximize itself.
Instead, you just set the window coordinates so that it is maximally large, but still has the NORMAL status.
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
Benutzerbild von KodeZwerg
KodeZwerg

Registriert seit: 1. Feb 2018
3.691 Beiträge
 
Delphi 11 Alexandria
 
#8

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

  Alt 29. Jun 2022, 16:34
Three options you have that work for me.
1. Create a borderless window and code your own caption
2. Overwrite the maximize method
3. Use Styles
Gruß vom KodeZwerg
  Mit Zitat antworten Zitat
jimsweb

Registriert seit: 30. Mai 2013
5 Beiträge
 
#9

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

  Alt 29. Jun 2022, 18:43
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;
  Mit Zitat antworten Zitat
jimsweb

Registriert seit: 30. Mai 2013
5 Beiträge
 
#10

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

  Alt 29. Jun 2022, 14:51
Hi...

Welcome...
This forum is in german language...
There are an english Version of the DelphiPraxis. https://en.delphipraxis.net
There you will be better helped...because they understand you.

thank you and apologize for posting in German forum..

Unfortunately, it doesn't allow me to login/regiter in the english forum.. it says, i have an active user id /password in German forum.. but when i try to use my existing credentials, it doesn't allow me to login not sure how can i fix this..
  Mit Zitat antworten Zitat
Antwort Antwort

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:28 Uhr.
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