// 模态窗口是无法直接最小化的
不会吧,只是不能到任务条。看下面演示:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
unit Unit1; // MainForm
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
uses Unit3;
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin // 显示模式 Form3
Form3.ShowModal;
end;
end.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
unit Unit2; // 这个窗体需要动态建立
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
end;
var
Form2: TForm2;
implementation
uses Unit3;
{$R *.DFM}
procedure TForm2.Button1Click(Sender: TObject);
begin // 最小化模式 Form3
SendMessage(Form3.Handle,$0112,$F020,0);
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
FormStyle:= fsStayOnTop;
end;
procedure TForm2.FormShow(Sender: TObject);
begin
Width := 210;
Height:=160;
end;
end.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
unit Unit3; // 被模式显示的窗体
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm3 = class(TForm)
procedure FormShow(Sender: TObject);
end;
var
Form3: TForm3;
implementation
uses unit2;
{$R *.DFM}
procedure TForm3.FormShow(Sender: TObject);
begin
Form2:=TForm2.Create(Self);
form2.Show;
end;
end.