![]() |
Kein Fenstertitel und trotzdem maximiert
Wenn man ein Fenster, dass keinen Fenstertitel haben soll und maximiert ist (sprich die Eigenschaft BorderStyle auf bsNone und die Eigenschaft WindowState auf wsMaximized des Forms steht), so wird auch die Taskbar überdeckt. Unter Umständen ein unschöner Effekt.
Umgehen kann man das mit folgender Methode:
Delphi-Quellcode:
Daniel hat dies in
procedure TfrmMain.RequestAlign;
var rect: TRect; begin SystemParametersInfo(SPI_GETWORKAREA, 0, @rect, 0); Constraints.MaxHeight := rect.Bottom; inherited RequestAlign; end; {Die Funktion muss natürlich als Methode von TfrmMain deklariert werden} ![]() Das Problem kann man umgehen, in dem man sich eine neue Funktion schreibt, die auf die Nachricht WM_GETMINMAXINFO reagiert. Auszug aus dem MSDN zu WM_GETMINMAXINFO The MINMAXINFO structure contains information about a window's maximized size and position and its minimum and maximum tracking size. Schreibt man daraus eine neue Funktion (keine Erweiterung für obige Funktion) so kann man folgende Funktion verwenden, egal wo die Taskbar sich befindet:
Delphi-Quellcode:
Diese muss folgendermaßen als Methode von TfrmMain deklariert werden:
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;
Delphi-Quellcode:
Diese Methode stammt ebenfalls von Daniel.
procedure WMGetMinMaxInfo(var Msg: TWMGetMinMaxInfo); message WM_GETMINMAXINFO;
|
Re: Kein Fenstertitel und trotzdem maximiert
Würde nicht auch ein einfaches...
Delphi-Quellcode:
... reichen?
Procedure TFormIrgendWas.WMGetMinMaxInfo(Var Msg: TWMGetMinMaxInfo);
Var MoniRect: TRect; Begin MoniRect := Screen.Monitors[Monitor.MonitorNum].WorkareaRect; With MoniRect Do Begin msg.MinMaxInfo.ptMaxSize := TopLeft; msg.MinMaxInfo.ptMaxSize := Point((Right - Left), (Bottom - Top)); End; End; Man muss doch nicht immer alles auf Teufel komm' raus mit Pointern erschlagen. Vor Allem wenn auch ein 3-Zeiler den Job erfüllt. ;) |
Re: Kein Fenstertitel und trotzdem maximiert
So wäre es ein 2-Zeiler. :mrgreen:
Delphi-Quellcode:
Edit: Ich habe gerade einen Tippfehler gefunden.
Procedure TFormIrgendWas.WMGetMinMaxInfo(Var Msg: TWMGetMinMaxInfo);
Begin With Monitor.WorkareaRect Do Begin msg.MinMaxInfo.ptMaxPosition := TopLeft; msg.MinMaxInfo.ptMaxSize := Point((Right - Left), (Bottom - Top)); End; End; Ich hatte 2-mal ptMaxSize geschrieben :oops: |
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:49 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