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.

相关文章

 从网上看到《Delphi API HOOK完全说明》这篇文章,基本上都...
  从网上看到《Delphi API HOOK完全说明》这篇文章,基本上...
ffmpeg 是一套强大的开源的多媒体库 一般都是用 c/c+&#x...
32位CPU所含有的寄存器有:4个数据寄存器(EAX、EBX、ECX和ED...
1 mov dst, src dst是目的操作数,src是源操作数,指令实现的...