What is the correct way to add an enumerated type to a custom control property so that the client can select a choice of enumerations in the control's Properties setting at Design Time?
I have a custom button control and I want the client to select a button style from an enumerated range of values:
But when I try to expose it thusly:Code:public enum BUTTONSTYLE { Style_Solid, Style_GradientA, Style_GradientB, Style_Image, Style_Liquid };
Visual Studio 2005 crashes and disappears without any error messages as soon as I drag and drop the control onto a form! It leaves nothing in the Event Log and the control disappears from the toolbox! What an I doing wrong and how do I debug this?Code:[DefaultValue( BUTTONSTYLE.Style_Solid)] [Category("Appearance")] [Browsable(true)] [Description("Sets style of the button")] public BUTTONSTYLE newbuttonstyle { get { return newbuttonstyle; } set { newbuttonstyle = value; } }
My button already has other (non-enum) custom properties that work just fine.
Thanks in advance for any insights.
(PS - I've been using Visual Studio 2005 since, well, 2005, and this is the fist time I've ever actually crashed it!)




Reply With Quote
