is 是判断语句
as 是强制类型转换

解决方案 »

  1.   

    for i := 1 to self.ComponentCount do begin
        if self.Components[i] is tedit then
          (Self.Components[i] as Tedit).Text := '';
      end;
    //遍历窗体上的edit,使它的text为空 ;
    不过不必要用(Self.Components[i] as Tedit)来转换两次,用Tedit(Self.Components[i])就可以了。
      

  2.   

    is:判断对象类型
    as:对象类型向下映射
    用法如楼上
      

  3.   

    is:判断对象类型
    as:是强制类型转换
      

  4.   

    is 是判断对象类型
    as 是强制类型转换,把其他类型转换成目标类型,用的时候要小心点!