如何在 TButton 中显示图标?

How to show an icon in a TButton?

我的主窗体有一个连接到 TImageList 的 TActionList 组件。问题是 TImageList 最近在 DataModule 中被移动了。现在,当我将动作分配给 TButton 时,与该动作关联的图像不会出现在按钮中。

如何解决这个问题,同时将图像列表保留在数据模块中?

您应该将 TButton 中的图像 属性 分配给同一个 ImageList。

对我有用。

当然,DM 的单位必须包含在表格的单位中(在 uses 列表中),并且 TButtonImages 属性 必须是(重新)设置为图像列表。