List<string> list = new List<string>(); list.Add("textBox2"); list.Add("textBox1"); list.Add("txtNum"); StringBuilder sb = new StringBuilder(); foreach (Control ctl in this.Controls) { if (ctl is TextBox) { //txtN…
方法一: Var I: Integer; Begin For I := To ComponentCount - Do //获取组件数量 Begin If Components[I] Is TWinControl Then Begin If (Components[I] As TWinControl).Focused Then Begin Self.Caption := (Components[I] As TWinControl).Name; Break; End; End; End; 方法二:…