unit dForm;interfaceuses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
  TLHBForm = class(TForm)
  private
    { Private declarations }
  protected
    { Protected declarations }
  public
    { Public declarations }
  published    { Published declarations }
  end;procedure Register;implementationprocedure Register;
begin
  RegisterComponents('setup', [TLHBForm]);
end;
 
end.
控件编写如上:
  当我动态创建一个窗体时,即pform :=TLHBForm.Create(Application)
  程序运行报错,请问是什么原因?

解决方案 »

  1.   

    报措如下:Resource TLHBForm not Found
      

  2.   

    你这个控件怎么从form继承阿.
      

  3.   

    这样好像是不太行的吧,直接将Form作为控件??这个错误是没有资源,你的Form肯定有一些可视化的代码,属性的设置值被保存在dfm文件中的,而这个资源并没有包含在单元中。
      

  4.   

    pform := TLHBForm.Create(Self);
      

  5.   

    关注中!
    不知是否需要添加继承Tform的create,destroy方法。
      

  6.   

    我用了Tform的create,destroy方法,但是还是没用
      

  7.   

    你应该做一个Dfm,且文件名与此PAS单元文件名只是扩展名不同。然后修改PAS文件。
    ...implementation//注意加上这一句
    {$R *.dfm}...
      

  8.   

    yjs_lh(长风浪子) :
     还是不行,我的油箱[email protected]
     将你做好的给我看看,谢谢!
      

  9.   

    不行的
    我看了看VCL的源码
    如果FORM不是TFORM
    而是其他从Tcustomform下继承的
    包括tcustomform本身的话
    在create里只要检查出类名不是tform就要查找
    相应的dfm资源如果没有就会报这个错
    用常规方法实现不了
    如果用registerclass和createwindow
    api来实现或许可以一试
      

  10.   

    我做过一个,
    你的这个TLHBForm要放到Tfrom上吗?
      

  11.   

    搞定了!type
      TA =class(TForm)
      end;
    var
      A :TA;
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      A :=TForm.CreateParented(Handle);
      A.Show;
    end;