比如说,我要判断 edit1是否存在属性 color
请大师指点

解决方案 »

  1.   

    uses TypInfo;{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
      if GetPropInfo(Edit1, 'Color') <> nil then
        ShowMessage('TEdit有Color属性');
    end;————————————————————————————————————
    宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
    ————————————————————————————————————
      

  2.   

    这个函数判断AComponent是否存在“Color”属性
    function HaveColor(AComponent:TComponent):Boolean;
    Var
      PropInfo:PPropInfo;
    Begin
      PropInfo:=GetPropInfo(AComponent.ClassInfo,'Color');
      Result:=PropInfo<>nil;
    End;
      

  3.   

    Faint !
    我打字真慢!居然是三楼!!!!!!
      

  4.   

    好像没有这种方法。只能通过类来判断,例如tcontrol类都有color属性,可以判断该对象是否tcontrol类