1
13878578191
Unregistered / Unconfirmed
GUEST, unregistred user!
我建立了mainFrm,childFrm1,childFrm2,childFrm3分别作为主窗体和子窗体。
请大家帮我看看下面这段代码有什么问题?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin;
type
TmainFrm = class(TForm)
CoolBar1: TCoolBar;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
procedure openForm(childFrm1:TForm);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
mainFrm: TmainFrm;
implementation
uses Unit2, Unit3, Unit4;
{$R *.dfm}
procedure TmainFrm.openForm(childFrm1:TForm);
begin
if childFrm1<>nil then
childFrm1.BringToFront
else begin
childFrm1:=TchildFrm1.Create(application);
childFrm1.Show;
end;
end;
procedure TmainFrm.ToolButton1Click(Sender: TObject);
begin
openForm(childFrm1);
end;
procedure TmainFrm.ToolButton2Click(Sender: TObject);
begin
openForm(childFrm2);
end;
procedure TmainFrm.ToolButton3Click(Sender: TObject);
begin
openForm(childFrm3);
end;
end.
如果我不自定义过程的话,运行没有问题,但是现在运行达不到预期的效果!
在线等待……………………
请大家帮我看看下面这段代码有什么问题?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin;
type
TmainFrm = class(TForm)
CoolBar1: TCoolBar;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
procedure openForm(childFrm1:TForm);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
mainFrm: TmainFrm;
implementation
uses Unit2, Unit3, Unit4;
{$R *.dfm}
procedure TmainFrm.openForm(childFrm1:TForm);
begin
if childFrm1<>nil then
childFrm1.BringToFront
else begin
childFrm1:=TchildFrm1.Create(application);
childFrm1.Show;
end;
end;
procedure TmainFrm.ToolButton1Click(Sender: TObject);
begin
openForm(childFrm1);
end;
procedure TmainFrm.ToolButton2Click(Sender: TObject);
begin
openForm(childFrm2);
end;
procedure TmainFrm.ToolButton3Click(Sender: TObject);
begin
openForm(childFrm3);
end;
end.
如果我不自定义过程的话,运行没有问题,但是现在运行达不到预期的效果!
在线等待……………………