📄 lc_bcb_15.txt
字号:
BCB中派生VCL类
BCB中派生VCL类及动态地创建控件
以生成一个TMemo的派生类及动态地创建该VCL控件为例。
ClassTMemoEx:publicTMemo
{
.
.
}
externTMemoExmemoex;
ClassTForm1:ClassTForm
{
public:
TMemoEx*MemoEx;
.
.
}
void_fastcallTForm1::FormShow(TObject*Sender)
{
MemoEx=newTMemoEx(this);
MemoEx->Parent=this;
.
.
}
总之,遵循以下步骤即可:
类定义;
externTMemoExmemoex;
TMemoEx*MemoEx;
MemoEx=newTMemoEx(this);
MemoEx->Parent=this;
返回