L
leejames
Unregistered / Unconfirmed
GUEST, unregistred user!
try this.
Form1 上放个 Panel, Panel上放Button1、2
Button3放在Form1上。
--------------------- Form1 ---------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage('1');
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ShowMessage('2');
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
form2.Show;
end;
end.
---------------------- Form2 -----------------------
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm2 = class(TForm)
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses Unit1;
{$R *.dfm}
var
pan: TPanel;
procedure TForm2.FormShow(Sender: TObject);
begin
Form1.Hide;
pan:=TPanel.Create(nil);
pan:=Form1.Panel1;
pan.Parent:=Form2;
end;
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Form1.Show;
pan.Parent:=Form1;
pan:=nil;
end;
end.
Form1 上放个 Panel, Panel上放Button1、2
Button3放在Form1上。
--------------------- Form1 ---------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage('1');
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ShowMessage('2');
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
form2.Show;
end;
end.
---------------------- Form2 -----------------------
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm2 = class(TForm)
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses Unit1;
{$R *.dfm}
var
pan: TPanel;
procedure TForm2.FormShow(Sender: TObject);
begin
Form1.Hide;
pan:=TPanel.Create(nil);
pan:=Form1.Panel1;
pan.Parent:=Form2;
end;
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Form1.Show;
pan.Parent:=Form1;
pan:=nil;
end;
end.