Wordsmyth's Corner

How to Hide Properties

Explains how to hide custom control properties in the VS .NET designer. There are two ways to do this.

Option 1: Custom Designer Class

Create 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-Browsable

You 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;
            }
         }