0

I can override the Name property when the property is public but when I set it private it inherits Picturebox's Name. I want to make it private because I don't want this property to be shown in the objects that generated from MyPictureBox class. Thanks.

class MyPictureBox : PictureBox
{
    private string name;
    private new string Name
    {
        get { return name; }
        set { name = value; }
    }
}
ctulu
  • 444
  • 1
  • 6
  • 23
  • No it does not throw an error. For example when I create an object from MyPictureBox I can still use myPictureBox.Name. I don't want it to be appeared. – ctulu Feb 09 '14 at 19:35

1 Answers1

1

I believe SO has an answer for you right here: Hiding unwanted properties in custom controls

Community
  • 1
  • 1
Janis F
  • 2,637
  • 1
  • 25
  • 36