如何向表单添加自定义属性 [英] How do I add custom properties to a form

查看:1109
本文介绍了如何向表单添加自定义属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一个自定义属性添加到可以通过Delphi属性编辑器访问的基础表单。如果我只是使用标准组件添加属性,属性将不会显示在属性编辑器中。这是我试过的:

I am trying to add a custom property to a base form that can be accessed via the Delphi property editor. If I simply add the property as I would with a standard component the property won't show up in the property editor. Here's what I tried:

unit TestForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TfrmEasyIPBase = class(TForm)
  private
    FTest: String;
  public
    { Public declarations }
  published
    property Test: String read FTest write FTest;
  end;

var
  frmEasyIPBase: TfrmEasyIPBase;

implementation

{$R *.dfm}

end.

我有必要在某个时候注册该资源吗?

Do I have to register the property at some point?

推荐答案

RegisterCustomModule应该做的伎俩。

RegisterCustomModule should do the trick.

这篇关于如何向表单添加自定义属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆