This is against OOP principals. All properties etc of the base object shold be present in the deriving object.
However, Microsoft do this themselves all the time! The
PictureBox
is a good example. It has no browsable
Text
property in the property grid or in the code editor via intellisense, but it's still there as it derives from
System.Windows.Forms.Control
which has the
Text
property.
The way to achieve this is to do something like this with properties, events and methods that you don't want to be visible.
using System;<br />using System.ComponentModel;<br />using System.Drawing;<br />using System.Windows.Forms;<br /><br />public class MyPictureBox : PictureBox<br />{<br /> [Browsable(false)]<br /> [EditorBrowsable(EditorBrowsableState.Never)]<br /> [Obsolete("This property is obselete", true)]<br /> public new Color BackColor<br /> {<br /> get { return base.BackColor; }<br /> set { base.BackColor = value; }<br /> }<br />}
This will make the BackColor property 'disappear'
IF MyPictureBox is in a
seperate assembly. It will not work if in the same assembly, or added as a project reference to another project - it must be a reference to a seperate dll.