BCB 动态创建组件的事件响应

http://blog.csdn.net/sding/article/details/3996758

学习BCB中的历程,一点点的记录下来,呵呵

class PACKAGE MyTPanel : public TPanel
{
private:
TLabel *lblToday;

void __fastcall lblTodayClick(TObject *Sender);
.....................

};

void __fastcall MyTPanel::InitCtrl()
{

lblToday = new TLabel(this);
lblToday->Left = Left + 174;
lblToday->Top = Top + 14;
lblToday->Width = 48;
lblToday->Height = 12;
lblToday->Caption = "今天";
lblToday->Cursor = crHandPoint;
lblToday->Font->Color = clBlue;
lblToday->Parent = this;
lblToday->OnClick = lblTodayClick;
lblToday->Visible = true;

}

void __fastcall MyTPanel::lblTodayClick(TObject *Sender)
{
ShowMessage("Hello World");
}


你可能感兴趣的:(BCB 动态创建组件的事件响应)