如何在TcustomControl中添加Taboutbox?
-
17-09-2020 - |
题
我想在自定义组件上添加关于框/对话框。如何在对象检查器上显示小按钮[...]?就像在计时组件上分配保密一样。
解决方案
您必须定义类似于此的属性:
//: Información acerca del paquete de componentes
property AboutMe:TFAbout read FAboutG stored false;
.
tfabout 是一个类,它定义了要查看的表单(关于表单),当用户单击“对象检查器”中的属性时。
此外,如果您愿意使用三点查看Buitton |,您必须注册“属性编辑器”。在oi。
这是一个样本单元:
unit UTAboutProp;
interface
uses
DesignIntf, DesignEditors;
type
TAboutGProp = class(TPropertyEditor)
public
procedure Edit(); override;
function GetValue(): string; override;
function GetAttributes(): TPropertyAttributes; override;
end;
implementation
uses
SysUtils, FormAbout, UConstantes;
procedure TAboutGProp.Edit();
begin
with TFAbout.Create(nil) do
try
ShowModal();
finally
Free();
end;
end;
function TAboutGProp.GetValue(): string;
begin
result := Format(GLIBSI_LBL,[GLIBSI_VERSION]);
result := '1.0';
end;
function TAboutGProp.GetAttributes(): TPropertyAttributes;
begin
result := [paDialog,paReadOnly];
end;
end.
.
仅休息为“注册”此“属性编辑器”,以便与您的关于属性一起使用;这对于“链接”您的属性与 。
在其中有代码用于注册组件,添加代码的注册属性:
RegisterPropertyEditor(TypeInfo(TFAbout),nil,'',TAboutGProp);
.
关于
不隶属于 StackOverflow