在FMX中,如何将非可视组件视为设计时间(Delphi 10 Seattle)

时间:2015-10-06 13:34:19

标签: delphi custom-component delphi-10-seattle

我创建了许多非可视组件,并创建了适当的位图,并通过Projects | Resources和images添加了它们。我在工具调色板和结构窗口中看到了图像,但我在表单设计器中只得到了抓取句柄。

我还没有真正得到任何相关的代码。下图显示了我看到的内容

enter image description here

PS我没有隐藏可视组件!

更新

按要求编写的代码

uses
  System.SysUtils,
  System.Classes,
  System.Generics.Collections,
  System.IOUtils,
  UnitListComponents,
  FMX.Types,
  FMX.Controls;
  //FMX.Edit,
  //FMX.Listbox;

  TSigFile7BaseProperty = class(TControl)
  private
    ...
  end;

  TSigFile7File = class( TSigFile7BaseProperty )
  private
  protected
  public
  published
    property Text;
    property SaveAsRelativeFileName;
  end;

1 个答案:

答案 0 :(得分:1)

问题是你的组件是TControl的后代,它是可视FMX组件的基类,而不是非可视组件。

对于非可视组件的制作,您应该使用TComponent作为基类。

以下是Ray Konopka关于创建自定义Fire Monkey组件的视频的链接,该视频应该为您提供有关此主题的更多信息

http://firemonkeytutorial.com/creating-custom-delphi-firemonkey-components/

PS:当我第一次开始制作自定义组件时,我首先花了很多时间研究类似组件继承自哪些组件类。