Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2008 Feb : Full screen display
| Subject: | Full screen display |
| Posted by: | "Uwe" (forspammers@no.ne) |
| Date: | Thu, 28 Feb 2008 18:35:40 |
Hi
I'm using the following code to bring a TForm to full screen (incl. covering
the taskbar):
{...}
private
procedure WMGetMinMaxInfo(var msg: TWMGetMinMaxInfo); message
WM_GETMINMAXINFO;
{...}
procedure TForm1.WMGetMinMaxInfo(var msg: TWMGetMinMaxInfo);
begin
inherited;
with msg.MinMaxInfo^.ptMaxTrackSize do begin
X := GetDeviceCaps( Canvas.handle, HORZRES ) + (Width - ClientWidth);
Y := GetDeviceCaps( Canvas.handle, VERTRES ) + (Height - ClientHeight );
end;
end;
procedure TForm1.Action1Execute(Sender: TObject);
begin
{...}
SetBounds( Left - ClientOrigin.X, Top - ClientOrigin.Y, GetDeviceCaps(
Canvas.handle, HORZRES )
+ (Width - ClientWidth), GetDeviceCaps( Canvas.handle, VERTRES ) +
(Height - ClientHeight ));
{...}
end;
This works as expected. My problem though is to bring the form back to the
size and position it had before it was blown up to full screen. I tried
this...
{...}
if Key = #27 then
begin
Form1.BoundsRect := Rect(0, 0, 0, 0);
{...}
... but it only restores the TForm1 to its design time size and positions it
at 0,0 coordinates. Then I have to click **twice** on the restore button to
maximize it again. I also tried to set the Rect(...) to other values read
into variables before the form goes into full screen, but I get the same
result: Design time size and position 0,0. Why is this?
Using D2007 Pro and Vista Home Premium 32bit.
Thx
Uwe