delphi - 为什么 THotKey 没有 Align 属性,我该如何添加它?
问题描述
在 Windows 10 的 Delphi 10.4.2 32 位 VCL 应用程序中,我尝试使用THotKey
控件输入热键。由于我经常使用Align
属性来创建整洁的 UI,我想知道为什么THotKey
没有Align
属性。甚至TRzHotKeyEdit
,TJvHotKey
和TJvDotNetHotKey
没有Align
属性。
是否可以模拟THotkey.Align
属性?或者是否有另一个带有Align
属性的 HotKey 控件?
解决方案
创建一个单元以将其用作派生自的新组件THotKey
:
unit ExtHotKey;
// Published the Align property
interface
uses
System.Classes,
Vcl.ComCtrls;
type
TExtHotKey = class(THotKey)
published
property Align;
end;
procedure Register;
implementation
procedure Register;
begin
System.Classes.RegisterComponents('PAComponents', [TExtHotKey]);
end;
end.
然后将其插入新的或现有的包中并安装该包。
之后,该Align
属性在 Object Inspector 中可用,并且运行良好:
推荐阅读
- css - 在 CSS 文件中使用 :local 有什么好处?
- python - 将 Excel DAX 转换为 Pyspark
- python - 如何取回我存储的位置数据
- react-native - 如何使用带有树莓派的原生移动应用程序
- node.js - 连接处于关闭状态时无法添加新命令(knex.js with mysql2 + mysql8 + node.js 16)
- node.js - 如何使用猫鼬中的对象ID将一对多与引用应用
- matlab - 在matlab中对向量的每个值执行一个函数?
- netlify - 如何使用 API v1 contact_sync/contact_add 将联系人添加到 ActiveCampaign
- windows - Windows Curl 返回 (35) 发送失败:连接已重置
- javascript - 从 api url 中的数据绑定 react.js 中的格式化日期