Delphi Designer,是否继承了组件?

前端之家收集整理的这篇文章主要介绍了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.

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

猜你在找的Delphi相关文章