读书人

奇怪的有关问题 这是为何?()

发布时间: 2012-02-04 15:43:09 作者: rapoo

奇怪的问题 这是为何??(在线等)
void __fastcall TForm1::Button2Click(TObject *Sender)
{
TLabel*test=new TLabel(this);
test-> Caption =20;
Label1= test;
ShowMessage(Label1-> Caption); //窗体上的不显示为20 为何??

}

[解决办法]
这边显示的是20.
[解决办法]
void __fastcall TForm1::Button2Click(TObject *Sender)
{
TLabel*test=new TLabel(this);
test-> Caption =20;
Label1-> Caption = test-> Caption;
ShowMessage(Label1-> Caption);
}


[解决办法]
caption要用字符吧
test-> Caption =“20”;
这样试试看行不?

读书人网 >C++ Builder

热点推荐