子类控制,属性重写 [英] Subclass Control, Property Overrides

查看:86
本文介绍了子类控制,属性重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个子类化的列表框.

除了在构造函数中设置其属性外,还有一种方法可以锁定"其属性,以使子类控件甚至不公开它们?

I have a subclassed listbox.

Aside from setting it''s properties in the constructor is there a way to "lock" its properties so the subclassed control doesn''t even expose them?

推荐答案

一种方法是使用 IDesigner.PreFilterProperties() [本文 [<我的href ="http://www.codeproject.com/KB/miscctrl/NestedControlDesigner.aspx" target ="_ blank" title ="New Window"> ^ ].底部也有一些可能对您有用的链接.
One way to do this is to use the IDesigner.PreFilterProperties()[^] method.

This will not hide all properties, for example (from memory) it will not hide the Name property, although it works for most.

For an example of it''s use take a look at the last code snippet in this article[^] of mine. There are also some links at the bottom that may (or may not :) ) be useful to you.


这篇关于子类控制,属性重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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