我需要帮助如何实现类,可以显示在对象检查器 [英] I need help on how to implement class that can be shown in object Inspector

查看:183
本文介绍了我需要帮助如何实现类,可以显示在对象检查器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有

...
  TDispPitch = class
  private
    iLineSize: Integer;
    iLineColor: TColor;
    bDisplayAccent: Boolean;
    bVisible: Boolean;
  published
    property LineSize : Integer read iLineSize write iLineSize;
    ...etc
  end;
...

我希望Object Insepector中显示的这个功能可以编辑设置。

and i wanted this feature shown in Object Insepector to edit the settings.

我尝试添加

property DispPitch: TDispPitch read FDispPitch write FDispPitch. like 

可以显示DispPitch,但是我看不到它的属性。例如LineSize,LineColor等。

the DispPitch can be shown but i cannot see its properties. like LineSize, LineColor etc.

推荐答案

您必须从 TPersistent派生类或其后代,以便在对象检查器中可用:

You must derive your class from TPersistent, or a descendant, in order to make it available in the Object Inspector:

TDispPitch = class(TPersistent)
private
  ...
published
  property ...
  ...
end;

来自Delphi文档:

From Delphi Documentation:


TPersistent是所有具有赋值和
流功能的
对象的祖先。

TPersistent is the ancestor for all objects that have assignment and streaming capabilities.

这篇关于我需要帮助如何实现类,可以显示在对象检查器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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