program pTest;{$R *.res}uses
    Forms,
    uGameDisplay in '..\Source\uGameDisplay.pas';var
    GameForm: TGameForm;
begin
    Application.Initialize;
    Application.CreateForm(TGameForm, GameForm);
    Application.Run;
end.
-------------------------------------------------------------------------//这个是新建一个unit,然后自己写代码,不是新建一个Form自动生成的
Unit uGameDisplay;InterfaceUses    Forms;Type
    TGameForm = Class(TCustomForm)    Protected    Public
    End;Implementation
End.----------------------------------这样运行的时候出EResNotFound的错误TForm 的子类必须通过IDE新建Form吗?dmf 是必须的吗,里面的内容只是一些属性的设置而已

解决方案 »

  1.   

    Delphi6不需要吧,Delphi7后都要了吧,
      

  2.   

    用CreateNew,不要用Create,或者自己再override一个Create。看一下TCustomForm.Create就知道是怎么回事了
      

  3.   

    constructor TCustomForm.Create(AOwner: TComponent);
    begin
      GlobalNameSpace.BeginWrite;
      try
        CreateNew(AOwner);
        if (ClassType <> TForm) and not (csDesigning in ComponentState) then
        begin
          Include(FFormState, fsCreating);
          try
            if not InitInheritedComponent(Self, TForm) then
              raise EResNotFound.CreateFmt(SResNotFound, [ClassName]);

          finally
            Exclude(FFormState, fsCreating);
          end;
          if OldCreateOrder then DoCreate;
        end;
      finally
        GlobalNameSpace.EndWrite;
      end;
    end;