Delphi Designer,是否继承了组件?

我正在编写一个自定义组件编辑器,基本上类似于TActionList编辑器,因为它允许创建子组件.
编辑器具有添加/删除组件的按钮.

现在,我想知道是否继承了所选组件,以便我可以禁用删除按钮.
我没有在IDesigner或相关接口中找到任何此类成员.

如果我继续使用Designer.DeleteSelection(True)继续删除;然后我得到一个例外:

Selection contains a component,xxx,introduced in an
ancestor and cannot be deleted.

这不是太糟糕,但我宁愿首先禁用删除按钮.

解决方法

好的,显然有一种方法,通过检查csAncestor的TComponent.ComponentState,所以:

csAncestor in ComponentState

它是documented

csAncestor – The component was introduced in an ancestor form. Only set if csDesigning is also set.

相关文章

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