i want to remove unnecessary properties from user control. But I do not know what way?
Asked
Active
Viewed 3,238 times
2 Answers
10
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
- 922,412
- 146
- 1,693
- 2,536
1
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
- 213,145
- 36
- 401
- 431