这几天一直做winform控件,在中间遇到不少问题,今天就在自定义控件的属性下拉选项中卡住了,网上很多解释,千篇一律的DTableStateSelect例子。于是自己动手写个自己的例子,大家更容易理解。源码: using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing; namespace MyControl { public partial class UserControl1 : UserControl { public enum MySelects { first=1, select=2 } private MySelects _TestAttribute; [Description("自定义属性")] public MySelects TestAttribute { get { return _TestAttribute; } set { ///下面的set方法是为了说明枚举的使用方法 _TestAttribute = value; if (_TestAttribute == MySelects.first)