继承自TCustomForm窗口,创建时,提示资源找不到

chinayu2007 2015-09-16 04:55:04

class TFormControl:public TCustomForm
{
public:
__fastcall TFormControl(TComponent* Owner);

};
__fastcall TFormControl::TFormControl(TComponent* Owner):TCustomForm(Owner)
{
this->Left = 20;
this->Top = 20;
this->Width = 200;
this->Height = 400;

}
TFormControl *Form2 = new TFormControl(NULL); //提示TFormControl 类资源找不到
...全文
82 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ccrun.com 2015-09-16
  • 打赏
  • 举报
回复
你需要重载一个构造函数,增加Dummy参数:
class TFormControl:public TCustomForm
{
	public:
	__fastcall TFormControl(TComponent* Owner);
	__fastcall TFormControl(System::Classes::TComponent* AOwner, int Dummy);

};
__fastcall TFormControl::TFormControl(TComponent* Owner):TCustomForm(Owner)
{
   this->Left = 20;
   this->Top  = 20;
   this->Width = 200;
   this->Height = 400;
}
__fastcall TFormControl::TFormControl(TComponent* AOwner, int Dummy):TCustomForm(Owner, Dummy)
{
   this->Left = 20;
   this->Top  = 20;
   this->Width = 200;
   this->Height = 400;
}
然后这样创建:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TFormControl *Form2 = new TFormControl(this, 0);
Form2->Show();
}
缘中人 2015-09-16
  • 打赏
  • 举报
回复
obj删除干净,完整编译。 报错准确提示是什么

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧