views:

176

answers:

2

hi all, i want to remove unnecessary properties from user control. But I do not know what way?

+1  A: 

You can't remove the properties your control inherits from UserControl.

You can, of course, remove properties you've created yourself. Just delete them from your source file.

dtb
+3  A: 

You can remove inherited properties from the Properties window with the [Browsable] attribute:

[Browsable(false)]
public override bool AutoScroll {
  get { return base.AutoScroll; }
  set { base.AutoScroll = value; }
}
[Browsable(false)]
public new Size AutoScrollMargin {
  get { return base.AutoScrollMargin; }
  set { base.AutoScrollMargin = value; }
}

Note the difference between the two, you have to use the "new" keyword if the property isn't virtual. You can use the [EditorBrowsable(false)] attribute to also hide the property from IntelliSense.

Hans Passant