我知道如何在设计时创建框架并将其放在Delphi中运行时的面板中。至于C ++ Builder,由于我不熟悉C ++脚本,因此看起来很困难。请告知如何正确行事?
提前致谢
答案 0 :(得分:2)
解决方案与Delphi完全相同,您只需要使用C ++语法。
这样的事情应该有效:
/*
Assuming your frame is located in a unit called Frame1, and it's
called TMyFrameType, this is what you should add your Form unit
cpp file.
*/
#include "Frame1.h"
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
// This assumes you have a panel in this form called "ThePanelWhereIWantIt".
// You could move the MyFrameInstance to the class definition, if you need to
// access it somewhere after in your form code, but this is trivial.
TMyFrameType *MyFrameInstance;
MyFrameInstance = new TMyFrameType(ThePanelWhereIWantIt);
MyFrameInstance->Parent = ThePanelWhereIWantIt;
MyFrameInstance->Align = alClient;
}
//---------------------------------------------------------------------------