在属性查看器中隐藏嵌套属性 [英] Hiding nested properties in property viewer

查看:74
本文介绍了在属性查看器中隐藏嵌套属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我有一个自定义控件,其中有一个TextBox类型的属性.我希望用户在窗体上拥有此UserControl时,可以从设计者处进行设置.但是,我只需要显示TextBox,而不显示TextBox包含的属性.
一个类似的示例是,当在ListView中,在属性窗口中显示LargeImageList属性时,ImageList控件的属性未显示为嵌套属性".用户只需从表单上现有的ImageList设置ImageList即可,这就是全部.
我相信我已经能够正确回答我的问题.
我想我必须用一些属性标记财产.但是谷歌搜索并没有产生任何结果. :(有什么建议吗?
感谢您阅读本文.
问候,
S

Hi All,
I have a custom control in which I have a property of type TextBox. I wish the user to set it from the designer when he has this UserControl on his form. However, I only have the need to display only the TextBox and not the properties that a TextBox contains.
A similar example is when in a ListView, the LargeImageList property is displayed in the proeprty window, the properties of an ImageList control are not displayed as "nested properties". The User simply sets the ImageList from the existing ImageLists on the form and thats all.
I believe I have been able to put my question correctly.
I guess I have to tag the proeprty with some attribute. But googling did not yield anything. :( Any suggestions?
Thanks for reading this.
regards,
S

推荐答案

1.将TextBox放入您的UserControl private中.
2.在UserControl中创建一个属性,该属性公开隐藏"的TextBoxText属性.
3.尽情享受!
1. Make the TextBox inside your UserControl private.
2. Create a property in your UserControl which exposes the "hidden" TextBox''s Text property.
3. Enjoy!


这篇关于在属性查看器中隐藏嵌套属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆