动态生成的控件在设计期不能获得焦点,鼠标无法选取,请问是怎么回事?谢谢

wltom 2007-04-17 08:56:53
重新封装了tspeedbutton,在新的控件中又NEW了几个BUTTON,但这些BUTTON在设计获取不了焦点,
TSpeedButton *btn = new TSpeedButton(this);
btn->Left=Left+(i+1)*Width;
btn->Top=Top;
btn->Width=Width;
btn->Height=Height;
btn->Parent=this->Parent;
btn->Flat = false;
btn->Enabled = true;
btn->Visible = true;
btn->Cursor = crDefault;

...全文
143 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Jim@luckeeinc.com 2007-04-17
  • 打赏
  • 举报
回复
TButton *btn = new TButton(Application);
btn->Left=10;
btn->Top=10;
btn->Width=20;
btn->Height=20;
btn->Enabled = true;
btn->Visible = true;
btn->Cursor = crDefault;

btn->Name = "b1"; //name是一定要的
btn->Parent=this; //parent应该是这个Form吧 不是Form的parent 不能用this->Parent

602

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder VCL组件使用和开发
社区管理员
  • VCL组件使用和开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧