self.FindComponent是什么?

解决方案 »

  1.   

    在本窗体中找控件,空间的名字是self.FindComponent('tedit1')中的tedit1;
      

  2.   

    for i=1 to 10
    begin
    (form1.findcomponent('Label'+inttostr(i)) as TQRLabel).caption:=inttostr(i);
    end;
    将窗体中所有的Label的caption设置为i
      

  3.   

    FindComponent方法 对应对象:所有组件声明:function FindComponent(const AName: string): TComponent;功能:FindComponent方法在当前的组件的Components数组中指出给定的组件。被传递给FindComponent中的字符串是被寻找的组件名。例如“Edit1”,“Label1”。FindComponent将返回该组件(如果它存在),否则将返回空。例子://Use FindComponent to obtain another pointer to CheckBoxl procedure TForml.Button4Click(Sender: TObject); var MyComponent: TComponent; begin   MyComponent := FindComponent(’CheckBox1’);   TCheckBox(MyComponent).Checked := True; end;