Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi BorderStyle=nsNone und WindowState=wsMaximized (https://www.delphipraxis.net/4113-borderstyle%3Dnsnone-und-windowstate%3Dwsmaximized.html)

Daniel 15. Apr 2003 19:13


BorderStyle=nsNone und WindowState=wsMaximized
 
Die Kombination von myForm.BorderStyle=bsNone (um ein rahmenloses Fenster zu erhalten) und myForm.WindowState=wsMaximized (um es zu maximieren) bringt i.A. den unerwünschten Effekt mit sich, dass die Taskleiste ebenfalls übedeckt wird. Die Lösung besteht darin, die Methode "RequestAlign" des Formulars zu überschreiben, um so die Größenänderung steuern zu können.

Zuerst die Deklaration:

Delphi-Quellcode:
TfrmMain = class(TForm)
...
  procedure RequestAlign; override;
...
private
...
public
...
end;
Und dann die Methode selber:

Delphi-Quellcode:
procedure TfrmMain.RequestAlign;
var rect : TRect;
begin
  SystemParametersInfo(SPI_GETWORKAREA, 0, @rect, 0);
  Constraints.MaxHeight:= rect.Bottom;
  inherited RequestAlign;
end;

Mario 16. Apr 2003 07:01

Eine Idee dazu:
Wenn die Startleiste oben, links oder rechts ist, wird die Routine Probleme machen, oder?

Wie wäre es anstatt mit:
Code:
  myForm.BorderStyle := bsNone;
  myForm.Align := alClient;

Daniel 16. Apr 2003 09:32

Hallo,

erstmal Danke für den Hinweis. Ich habe erneut in die DOkumentation gesehen und festgestellt, dass es offenbar einen besseren Weg gibt, dieses Problem zu lösen: Man reagiert auf die Nachricht "WM_GETMINMAXINFO". Auszug aus der MSDN-Library:
Zitat:

Zitat von MSDN-Library
The MINMAXINFO structure contains information about a window's maximized size and position and its minimum and maximum tracking size.

Das scheint auch gut zu funktionieren - selbst wenn die Taskleiste oben, rechts oder links sitzt.

Die Deklaration:
Delphi-Quellcode:
procedure WMGetMinMaxInfo(var Msg: TWMGetMinMaxInfo); message WM_GETMINMAXINFO;
Die Implementation:
Delphi-Quellcode:
procedure TfrmMain.WMGetMinMaxInfo(var Msg: TWMGetMinMaxInfo);
var rect : TRect;
Begin
  SystemParametersInfo(SPI_GETWORKAREA, 0, @rect, 0);

  Msg.MinMaxInfo^.ptMaxSize.X:= rect.Right-rect.Left;
  Msg.MinMaxInfo^.ptMaxSize.Y:= rect.Bottom-rect.Top;

  Msg.MinMaxInfo^.ptMaxPosition.X:= rect.Left;
  Msg.MinMaxInfo^.ptMaxPosition.Y:= rect.Top;

  Msg.Result:= 0;
End;


Alle Zeitangaben in WEZ +1. Es ist jetzt 22:21 Uhr.

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