c#构造ColorComboBox(颜色下拉框)
复制代码 代码如下: class ColorComboBox : ComboBox { /// <summary> /// 当前选中色 /// </summary> public Color SelectedColor { get { return Color.FromName(this.Text); } } /// <summary> /// 构造函数,构造颜色下拉列表 /// </summary> public ColorComboBox() { this.DrawMode = DrawMode.OwnerDrawFixed; this.DropDownStyle = ComboBoxStyle.DropDownList; this.ItemHeight = 25; PropertyInfo[] propInfoList = typeof(Color).GetProperties(BindingFlags.Static | BindingFlags.DeclaredOnly | BindingFlags.Public); protected override void OnDrawItem(DrawItemEventArgs e) if (e.Index >= 0) 您可能感兴趣的文章:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |