程序隐藏状态栏全屏显示

时间:2021-12-28 16:04:48

程序可以在隐藏状态栏全屏显示和原始状态显示之间切换

unit Unit13;


interface


uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;


type
  TForm13 = class(TForm)
    btn1: TButton;
    procedure btn1Click(Sender: TObject);
  private
    { Private declarations }
    L, T, W, H : integer;
  public
    { Public declarations }
  end;


var
  Form13: TForm13;


implementation


{$R *.dfm}


procedure TForm13.btn1Click(Sender: TObject);
begin
  if Self.BorderStyle = bsNone then
  begin
    Showwindow(Findwindow('Shell_TrayWND',nil), SW_SHOWDEFAULT);
    Self.Left := L;
    self.Top := T;
    Self.Width := W;
    self.Height := H;
    Self.BorderStyle := bsSizeable;
  end
  else
  begin
    Showwindow(Findwindow('Shell_TrayWND',nil), SW_HIDE);


    L := Self.Left;
    T := self.Top;
    W := Self.Width;
    H := self.Height;


    Self.width:=screen.width;
    Self.height:=screen.height;
    Self.Top := 0;
    Self.Left := 0;
    Self.BorderStyle := bsNone;
  end;
end;


end.