How can I paint a representation of enum values using a UITypeEditor?

The following HatchStyleEditor class draws a graphical representation for values in the HatchStyle enumeration. HatchStyleEditor is derived from UITypeEditor and overrides the GetPaintValueSupported method and returns true. GetPaintValueSupported indicates that this editor supports the painting of a representation of an object’s value. PaintValue paints the representative value to the canvas. public class HatchStyleEditor : UITypeEditor { public override bool GetPaintValueSupported(ITypeDescriptorContext context) { return true; } public override void PaintValue(PaintValueEventArgs e) { if (e.Value is HatchStyle) { HatchStyle hatch = (HatchStyle) e.Value; Brush br = new HatchBrush(hatch, SystemColors.WindowText, SystemColors.Window); e.Graphics.FillRectangle(br, e.Bounds); br.Dispose(); } } }

At designtime, how can I hide a base class property in my derived control from the user

Set the Browsable attribute on the new property that hides the existing one. Here is a code snippet that hides the WordWrap property in the derived TextBox. [C#] public class MyTextBox : TextBox { [Browsable(false)] public new bool WordWrap { get{ return false;} //always false set{} } } [VB.NET] Public Class MyTextBox Inherits TextBox _ Public Shadows Property WordWrap() As Boolean Get Return False ’always false End Get Set ’empty End Set End Property End Class ’MyTextBox

How do I implement a custom designer

Here are a couple of articles that discuss custom designers. Shawn Burke, in his article Wrinting Custom Designers for .NET Components at msdn. Brian Pepin, in his article .NET Shape Library: A Sample Designer at gotnetdot.com.

How do I provide Intellisense support to my controls while coding against them and also provide Description support for the properties in the property grid?

You can provide Intellisense support to your type and it’s members by providing xml comments in code as follows: /// <summary> /// Summary description for Form3. /// </summary> public class Form3 : System.Windows.Forms.Form { /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { } /// <summary> /// Summary of my property /// </summary> public bool MyProperty { get{..} set{..} } } Search for the ‘Tags for Documentation Comments’ topic in MSDN for all the available documentation tags. Then in your project, go to the Project Properties dialog, to the Configuration Properties/Build tab and specify a file for the XML Documentation File property. This will generate a file by that name when you compile your assembly. Place this xml file beside your dll. This will provide Intellisense support for your types in that assembly. To provide Description support for your properties in the property grid in the designer, add the DescriptionAttribute attribute to your properties in code. /// /// Summary of my property /// [Description(‘description of the property’)] public bool MyProperty { get{..} set{..} }