其实楼上的基本都已经能处理楼主的问题了,我也贴一个以前学习的代码让楼主参考一下unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); procedure MyButClick(Sender: TObject); private MyBut:Array of Tbutton; { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.MyButClick(Sender: TObject);beginshowmessage(format('%s%d%s',['你点的是第:',Tbutton(Sender).tag,'个按钮']));end;procedure TForm1.Button1Click(Sender: TObject);var i:Integer;begin Setlength(MyBut,3); for i :=0 to 2 do begin Mybut:=Tbutton.Create(self); with Mybut do begin Caption:=Format('%s%d',['MyBut',i]); Parent:=self; Top:=i*26; Tag:=i; OnClick:=MyButClick; end; end;end;end.对于要自定义标识的控件,我一般会使用Tag属性,因为有时候我动态创建的控件可能需要显示Caption,或是需要使用Name属生,所以自定义时我习惯用Tag属性