function GetCtrls(MyForm: TForm): TStringList;
var i: Integer; begin Result:=TStringList.Create; for i:=0 to MyForm.ComponentCount-1 do Result.Add(MyForm.Components[i].Name); end; procedure TForm1.Button1Click(Sender: TObject); begin Memo1.Lines.AddStrings(GetCtrls( Self)) ; end;
好的代碼像粥一樣,都是用時間熬出來的
|
|