Difference between revisions of "Talk:Application full screen mode"
From Free Pascal wiki
Jump to navigationJump to search (Created page with "I think of : [code] procedure TForm1.ToggleFullScreen; function IsFullScreen: boolean; var CheckScreenBounds: TRect; begin CheckScreenBounds := Screen.MonitorFr...") |
(No difference)
|
Latest revision as of 01:19, 4 December 2013
I think of : [code] procedure TForm1.ToggleFullScreen;
function IsFullScreen: boolean; var CheckScreenBounds: TRect; begin CheckScreenBounds := Screen.MonitorFromWindow(Handle).BoundsRect; Result := ((CheckScreenBounds.Top = Form1.BoundsRect.Top) and (CheckScreenBounds.Left = Form1.BoundsRect.Left) and (CheckScreenBounds.Bottom = Form1.BoundsRect.Bottom) and (CheckScreenBounds.Right = Form1.BoundsRect.Right)); end;
begin
if not IsFullScreen then begin // To full screen OriginalWindowState := WindowState; OriginalBounds := BoundsRect;
//BorderStyle := bsNone; ScreenBounds := Screen.MonitorFromWindow(Handle).BoundsRect; with ScreenBounds do SetBounds(Left, Top, Right - Left, Bottom - Top); end else begin
if OriginalWindowState = wsMaximized then WindowState := wsMaximized else with OriginalBounds do SetBounds(Left, Top, Right - Left, Bottom - Top);
end;
end; [/code]
This lets the design-time decision of BorderStyle be honoured when coming back from full screen, by not treating the BorderStyle variable as form state variable.