通过控件名获得控件
if(Form1->Controls[i]->Name != name)
{
Form1->Controls[i]->Caption=caption;//想改变该控件caption属性,但通过controls得不到caption,在网上查的只能通过强制转化成TLabel后才能取得caption,有没有更方便的方法啊???
}
[解决办法]
if (Form1->Controls[i]->ClassNameIs("TLabel"))
{
((TLabel *)Form1->Controls[i])->Caption = caption;
}[解决办法]
PPropInfo PropInfo = GetPropInfo(Control, "Caption");
if(PropInfo)
SetStrProp(Control,PropInfo,"NewCaption ");
这个是通过反射来实现的,速度并不怎么样。而且只改 Caption 实现的多语言会漏掉很多地方没改。