主题:一个窗口问题--怎样才能在子窗口上再创建一个窗口?
frm1 code:
unit frm1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ToolWin, ComCtrls, ExtCtrls, Buttons, Menus;
type
TForm1 = class(TForm)
ScrollBox1: TScrollBox;
BitBtn1: TBitBtn;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
MainMenu1: TMainMenu;
f1: TMenuItem;
ds1: TMenuItem;
df1: TMenuItem;
df2: TMenuItem;
df3: TMenuItem;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
procedure Button1Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
frm2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
form2:=Tform2.Create(self);
form2.Show;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
form2:=Tform2.Create(self);
form2.Width:=700;
form2.Height:=500;
form2.top:=0;
form2.Left:=175;
form2.Show;
end;
end.
-------------------------
frm2 code:
unit frm2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm2 = class(TForm)
Panel1: TPanel;
Button1: TButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
private
procedure WMGetMinMaxInfo (var Message:TWMGetMinMaxInfo);
message WM_GETMINMAXINFO;
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
Procedure Tform2.WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo);
begin
with Message.MinMaxInfo^ do
begin
ptMaxSize.X := 700;//最大化时候的宽度
ptMaxSize.Y := 500;//最大化时候的高度
ptMaxPosition.X :=100;//最大化时作上角横坐标
ptMaxPosition.Y :=175;
end;
Message.Result := 0; //告诉WINDOWS 改变了 minmaxinfo
inherited;
end;
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
action:=cafree;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
end;
end.
-----------------------
frm3 code:
unit frm3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm3 = class(TForm)
Panel1: TPanel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
procedure TForm3.FormCreate(Sender: TObject);
begin
end;
end.
------------------------------------
问题:
frm1主窗体 设置为主窗体
frm2子窗体 child
frm3子子窗体 设置为什么呢?
才能在frm2中的按钮点了之后,出现frm3?
谢谢!
unit frm1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ToolWin, ComCtrls, ExtCtrls, Buttons, Menus;
type
TForm1 = class(TForm)
ScrollBox1: TScrollBox;
BitBtn1: TBitBtn;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
MainMenu1: TMainMenu;
f1: TMenuItem;
ds1: TMenuItem;
df1: TMenuItem;
df2: TMenuItem;
df3: TMenuItem;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
procedure Button1Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
frm2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
form2:=Tform2.Create(self);
form2.Show;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
form2:=Tform2.Create(self);
form2.Width:=700;
form2.Height:=500;
form2.top:=0;
form2.Left:=175;
form2.Show;
end;
end.
-------------------------
frm2 code:
unit frm2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm2 = class(TForm)
Panel1: TPanel;
Button1: TButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
private
procedure WMGetMinMaxInfo (var Message:TWMGetMinMaxInfo);
message WM_GETMINMAXINFO;
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
Procedure Tform2.WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo);
begin
with Message.MinMaxInfo^ do
begin
ptMaxSize.X := 700;//最大化时候的宽度
ptMaxSize.Y := 500;//最大化时候的高度
ptMaxPosition.X :=100;//最大化时作上角横坐标
ptMaxPosition.Y :=175;
end;
Message.Result := 0; //告诉WINDOWS 改变了 minmaxinfo
inherited;
end;
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
action:=cafree;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
end;
end.
-----------------------
frm3 code:
unit frm3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm3 = class(TForm)
Panel1: TPanel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
procedure TForm3.FormCreate(Sender: TObject);
begin
end;
end.
------------------------------------
问题:
frm1主窗体 设置为主窗体
frm2子窗体 child
frm3子子窗体 设置为什么呢?
才能在frm2中的按钮点了之后,出现frm3?
谢谢!