请问如何动态的创建,并显示控件
代码如下:
//*.h
public:
TButton *Button2;
//*.cpp
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Button2=NULL;
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Button2= new TButton(Form1);
Button2->Width=25;
Button2->Top=200;
Button2->Height=40;
Button2->Caption="new";
Button2->Visible=true;
Button2->Show();
}
但结果却没有显示。请问各位高手,怎么样去解决呢?谢谢啦!!