delphi – 我需要有关如何实现可以在对象Inspector中显示的类的帮助

前端之家收集整理的这篇文章主要介绍了delphi – 我需要有关如何实现可以在对象Inspector中显示的类的帮助前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有
...
  TDispPitch = class
  private
    iLineSize: Integer;
    iLineColor: TColor;
    bDisplayAccent: Boolean;
    bVisible: Boolean;
  published
    property LineSize : Integer read iLineSize write iLineSize;
    ...etc
  end;
...

我想在Object Insepector中显示功能来编辑设置.

我尝试添加

property DispPitch: TDispPitch read FDispPitch write FDispPitch. like

可以显示DispPitch但我看不到它的属性.比如LineSize,LineColor等

解决方法

您必须从TPersistent或后代派生您的类,以使其在Object Inspector中可用:
TDispPitch = class(TPersistent)
private
  ...
published
  property ...
  ...
end;

来自Delphi文档:

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

原文链接:https://www.f2er.com/delphi/102922.html

猜你在找的Delphi相关文章