| |
|
| |
How to Hide PropertiesExplains how to hide custom control properties in the VS .NET designer. There are two ways to do this.Option 1: Custom Designer ClassCreate a custom "Designer" class for your control.Note: Must add System.Design to your assembly.
using System.Windows.Forms.Design;
// Define the designer you want to use with your control.
[Designer(typeof(TriangleButtonDesigner))]
public partial class TriangleButton : ...
{
}
public class TriangleButtonDesigner : ControlDesigner
{
protected override void PostFilterProperties(System.Collections.IDictionary properties)
{
base.PostFilterProperties(properties);
// Remove any properties you want to have, giving them by name.
properties.Remove("Font");
properties.Remove("Text");
properties.Remove("ForeColor");
...
}
// There are similar methods to hide attributes and events.
}
Option 2: Make Property Non-BrowsableYou can override the property and set its 'Browsable' attribute to false. Down side: Lots of extra code if there are lots of properties.
// Override properties we don't want the user to see...
[Browsable(false)]
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
}
}
| |
|
All content copyright 1996-2008 by Linda Naughton O'Meara unless otherwise noted.
Shadowrun is a copyright and trademark of WizKids, LLC.
Earthdawn is a copyright and trademark of FASA Corporation.
Crimson Skies is a copyright and trademark of Microsoft Corporation.
Babylon 5 is a copyright and trademark of Time Warner Entertainment.
Battlestar Galactica is a copyright of Sci Fi / Universal.
Any use of characters, names, places, etc. from these systems is done with the greatest respect for their creators, and is not intended as a challenge to any copyrights or trademarks.
| |