就像TBitBtn这样:
{************************************************************************}
unit BitBtnEx;interfaceuses
  Windows, Messages, SysUtils, Classes, Controls, StdCtrls, Buttons;type
  TBitBtnEx = class(TBitBtn)
  private
    { Private declarations }
  protected
    { Protected declarations }
  public
    { Public declarations }
  published
    { Published declarations }
  end;procedure Register;implementationprocedure Register;
begin
  RegisterComponents('Samples', [TBitBtnEx]);
end;end.{************************************************************************}
可以吗?

解决方案 »

  1.   

    To pazee:
       为什么在[Component]-[New component]->Ancestor Type: 中不能找以TForm呢?
      

  2.   

    To luojiehai:
      可以编译通过.
      我在我新的工程中use了这个单元,可以我在程序动态创建时
      testForm:=TFormEx.Create(nil); 
     
      执行时有错误提示:
      Resource TFormEx not found.
      

  3.   

    可以的, 我们开发中, 界面部分, 也做了个 baseform ,将一些重复的控件与代码写进去, 然后继承下来!!简化开发
      

  4.   

    你要安装你的新组件才行呀Component-> install component...
      

  5.   

    哦,不用安装的,你uses 你的单元再试试
      

  6.   

    这就是组件源代码,我什么都没有加的:
    unit CustomFormEx;interfaceuses
      Windows, Messages, SysUtils, Classes, Controls, Forms;type
      TCustomFormEx = class(TForm)
      private
        { Private declarations }
      protected
        { Protected declarations }
      public
        { Public declarations }
      published
        { Published declarations }
      end;procedure Register;implementationprocedure Register;
    begin
      RegisterComponents('Samples', [TCustomFormEx]);
    end;end.可是不行?
    (我不明白:[Component]-[New component]->Ancestor Type: 中不能找以TForm呢.Delphi为什么不提供.)谢谢大家.
      

  7.   

    需要为这个form提供一个dfm文件,并用{$R *.dfm}加入到pas文件中,不然会警告说资源未找到。
      

  8.   

    tonylk(tony) ,是对的.
    我在大富翁找到了.