📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses SingletonUnit2, SingletonUnit1;
var
aSingle: TSingletonl;
acSingle: TSingletonl;
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
aSingle := TSingletonl.Create;
Label1.Caption := IntToStr(Glob_Singletonlist.Count);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
acSingle := TChildSingletonl.Create;
Label1.Caption := IntToStr(Glob_Singletonlist.Count);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if aSingle <> nil then
begin
aSingle.Destroy;
aSingle := nil;
end;
Label1.Caption := IntToStr(Glob_Singletonlist.Count);
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
if acSingle <> nil then
begin
acSingle.Destroy;
acSingle := nil;
end;
Label1.Caption := IntToStr(Glob_Singletonlist.Count);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -