主题:[原创]关于窗体问题
			
 weicheng
				 [专家分:0]  发布于 2007-01-06 00:20:00							
			一个主窗体上有几个按纽,按每个按纽时,出现不同的子窗体,子窗体是嵌套在父窗体的某个特定位置,点了一个按纽后,再点另一个按纽的时候,要先把前一个按纽点出的界面关掉,但是现在还关不掉已经打开的那张界面,也就是说,按了几次按纽后,就会有几张界面出来,而不是只剩下一张界面
现在的问题是要怎么在另一张界面出来的时候,关掉已经打开的那张界面
						
					 
		
			
回复列表 (共2个回复)
		
								
				沙发
				
					
tanchuhan [专家分:15140]  发布于 2007-01-06 12:30:00				
				unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
[color=#0000FF]
uses Unit2, Unit3;
{$R *.dfm}
var
    frmActive:TForm;
procedure TForm1.Button1Click(Sender: TObject);
begin
    if assigned(frmActive) then frmActive.Close;
    form2.Show;
    frmActive:=form2;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
    if assigned(frmActive) then frmActive.Close;
    form3.Show;
    frmActive:=form3;
end;
[/color]
end.
							 
						
				板凳
				
					
zaliang [专家分:1010]  发布于 2007-01-06 16:01:00				
				同意楼上
							 
									
			
我来回复