我知道如何在设计时创建框架并将其放置在 Delphi 运行时的面板中。至于 C++ Builder,它看起来很困难,因为我不熟悉 C++ 脚本。请指教如何做正确的方法?
提前致谢
我知道如何在设计时创建框架并将其放置在 Delphi 运行时的面板中。至于 C++ Builder,它看起来很困难,因为我不熟悉 C++ 脚本。请指教如何做正确的方法?
提前致谢
该解决方案与 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;
}
//---------------------------------------------------------------------------