comboBox控件的创建和之前PictureBox的创建方式都差不多,都是定义字段,属性,重写方法以及重绘
新建winform项目,添加新类,并重新命名为myComboBox
添加引用
//添加引用 using System.Windows.Forms; using System.Drawing; using System.Drawing.Design; using System.Drawing.Drawing2D; using System.ComponentModel;
继承控件类
//继承控件类 class myComboBox:UserControl
定义字段
//定义字段 private Color backColor = Color.WhiteSmoke; //背景颜色 private Color iconColor = Color.Medi