📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, 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
uses Unit2, Unit3;
{$R *.DFM}
function hasForm(a:String):Boolean;
var
x : Integer;
r : Boolean;
begin
r := false;
for x := 0 to Screen.FormCount-1 do
begin
if Screen.Forms[x].Name = a then
r := true;
end;
result := r;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if not hasForm('Form2')then
begin
Application.CreateForm(TForm2,Form2);
ShowMessage('Form2 Create Now');
end;
Form2.Show;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if not hasForm('Form3')then
begin
Application.CreateForm(TForm3,Form3);
ShowMessage('Form3 Create Now');
end;
Form3.Show;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -