下面代码在win98、delphi3下完成,没装win2000没办法在win2000下测试:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Close_Button: TButton;
FullScreen_Button: TButton;
NormalScreen_Button: TButton;
procedure FullScreen_ButtonClick(Sender: TObject);
procedure NormalScreen_ButtonClick(Sender: TObject);
procedure Close_ButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
oldwidth,oldheight : integer;
oldleft,oldtop : integer;
isFullScreen : Boolean;
implementation
{$R *.DFM}
procedure TForm1.FullScreen_ButtonClick(Sender: TObject);
begin
if not isFullScreen then
begin
oldwidth :=form1.width;
oldheight :=form1.height;
oldleft :=form1.left;
oldtop :=form1.top;
showwindow(findwindow('Shell_TrayWND',nil),SW_HIDE);
form1.BorderStyle :=bsNone;
Form1.WindowState := wsMaximized;
isFullScreen :=True;
end;
end;
procedure TForm1.NormalScreen_ButtonClick(Sender: TObject);
begin
if isFullScreen then
begin
showwindow(findwindow('Shell_TrayWND',nil),SW_NORMAL);
form1.BorderStyle :=bsSingle;
Form1.WindowState := wsNormal;
form1.left :=oldleft;
form1.top :=oldtop;
form1.width :=oldwidth;
form1.height :=oldheight;
isFullScreen :=False;
end;
end;
procedure TForm1.Close_ButtonClick(Sender: TObject);
begin
close;
end;
end.