【问题标题】:how can i add a button to my VCL Component如何向我的 VCL 组件添加按钮
【发布时间】:2015-03-05 06:10:42
【问题描述】:

我已经创建了一个组件,现在我想向它添加一个按钮。
我试图创建这样的按钮:

constructor TUiCompU.Create(AOwner: TComponent);
begin
inherited;

  FButton := TButton.Create(Self);
....
End;

但按钮不显示。
我该怎么做?

【问题讨论】:

  • 控件的用户(程序员)打算如何与这个子控件交互?

标签: delphi custom-component


【解决方案1】:

您不仅需要Create() 按钮,还需要将其Parent 属性设置为您的组件:

FButton.Parent := Self;

【讨论】:

  • 亲爱的 rk_cap 非常感谢您
猜你喜欢
  • 2019-11-11
  • 2021-10-08
  • 1970-01-01
  • 1970-01-01
  • 2021-04-19
  • 2015-03-29
  • 2012-11-09
  • 2011-01-31
  • 1970-01-01
相关资源
最近更新 更多