gpt4 book ai didi

c# - CollectionEditor 的父级

转载 作者:太空宇宙 更新时间:2023-11-03 14:11:15 25 4
gpt4 key购买 nike

我有这样的属性:

[Editor(typeof(LayerCollection), typeof(UITypeEditor))]
public List<Layer> Layers { get { return layers; } }

我有一个派生自 CollectionEditorLayerCollection 类。而这个 Layers 属性在 Canvas 类中。现在,Layer 对象需要了解作为集合父级的 Canvas 类。那么如何才能获得名为 LayerCollection 的 CollectionEditor 的父级呢?

或者如果不可能,我可以在创建时将参数传递给 CollectionEditor 吗?通过这种方式,我可以在 Layer 创建时将 Canvas 对象作为参数传递给它。

最佳答案

“Hans Passant”在第一个帖子的评论中回答了我的问题:

The first argument to EditValue() is an ITypeDescriptorContext that gives you the context you need. Its Instance property references the control. – Hans Passant

关于c# - CollectionEditor 的父级,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7806545/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com