Custom Control Properties

  • Thread starter Thread starter Jon Turner
  • Start date Start date
J

Jon Turner

When developing a custom control, lets say I have a property named
"WidgetType" and
this property can consist of 3 types "WidgetStandard, WidgetEnhanced,
WidgetSimple".
How does my control notify the IDE that these are the types of WidgetType so
that the
IDE can display a Listbox with these types ? Does this have to be an enum ?

Many Thanks In Advance.
 
If you make it an enum the IDE will do the conversions fro you and display
your enumeration values in the property grid.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
If you want to add enum properties in custom control,first declare an enum
type like
private widgettype _theenum;
then add a property and set display style.
[DefaultValue( widgettype.something ),Category("the Category")]
public widgettype WidgetType
{
get
{
...
}
set
{
...
}
}
 
Back
Top