我要在运行的某个时刻窗体不能最大化,最小化,关闭,应怎样做?(100分)

  • 主题发起人 主题发起人 gravel
  • 开始时间 开始时间
真麻烦。象写控件那样写可能更适合你,参考以下的代码:
unit Unit1;

interface

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

type
TForm1 = class(TForm)
BtnTest: TButton;
BtnClose: TButton;
procedure BtnTestClick(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure BtnCloseClick(Sender: TObject);
private
FComeIn: Boolean;
procedure SetComeIn(const Value: Boolean);
public
Property ComeIn: Boolean Read FComeIn Write SetComeIn;
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

{ TForm1 }

procedure TForm1.SetComeIn(const Value: Boolean);
Const
IconSel : TBorderIcons = [];
begin
If FComeIn <> Value then
begin
FComeIn := Value;
If Value then
begin
If Form1.BorderIcons <> [] then
IconSel := Form1.BorderIcons;
Form1.BorderIcons := [];
end
else
begin
Form1.BorderIcons := IconSel;
end;
end;
end;

procedure TForm1.BtnTestClick(Sender: TObject);
begin
ComeIn := Not ComeIn;
end;

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := Not ComeIn;
end;

procedure TForm1.BtnCloseClick(Sender: TObject);
begin
Close;
end;

end.
 
多人接受答案了。
 

Similar threads

回复
0
查看
848
不得闲
D
回复
0
查看
911
DelphiTeacher的专栏
D
D
回复
0
查看
868
DelphiTeacher的专栏
D
S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
900
SUNSTONE的Delphi笔记
S
后退
顶部