unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); private { Private declarations } public { Public declarations } OriginalBounds: TRect; OriginalWindowState: TWindowState; ScreenBounds: TRect; procedure SwitchFullScreen; end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); const KeyF11 = 122; begin if Key = KeyF11 then SwitchFullScreen; end; procedure TForm1.SwitchFullScreen; begin if BorderStyle <> bsNone 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 // From full screen {$IFDEF MSWINDOWS} BorderStyle := bsSizeable; {$ENDIF} if OriginalWindowState = wsMaximized then WindowState := wsMaximized else with OriginalBounds do SetBounds(Left, Top, Right - Left, Bottom - Top) ; {$IFDEF LINUX} BorderStyle := bsSizeable; {$ENDIF} end; end; end.
Delphi F11 全屏
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Jquery 触发F11效果
1.注册和处理 通过不同类型事件的方法 例如 click(),mouseover(),mouseout()... 先准备一个盒子:<div></div> <style> div { width: 200px; height
Jquery 触发F11效果 jquery javascript 前端 点击事件