我这里所说的容器类是指能装入其它组件的组件。如form,panel,groupbox等等,他们能在其上面放其它的组件。
先谢啦!

解决方案 »

  1.   

     if Panel1 is TWinControl then
      

  2.   

    并不是是TWinControl的组件都能放其他组件呀,比如说TEDIT。
      

  3.   

    VAR
    I: integer
    begin
      for i:=0 to controlCount -1 do
        if (uppercase(controls[i].className = 'TPANEL')) OR 
           (uppercase(controls[i].className='TFORM')) or
           (uppercase(controls[i].className='TGROUPBOX')) then
         result = true;
         ........
    {
        这样写肯定可以,不知道有没有更好的办法?
    }
    end;
      

  4.   

    if edit1 is TWinControl then 这样也能通过呀,但edit1并不具备能放入其他组件的能力呀.
      

  5.   

    procedure TForm1.Button3Click(Sender: TObject);
    begin
     if csAcceptsControls in TControl(Sender).ControlStyle then
       showmessage('ok');
    end;