主要是注意两点,一点是在控件构造函数中设置一些属性,另一点是重写OnPaint方法,参考代码那如下:
class SelfControl:Control
{
public SelfControl()
{
//this.SetStyle(ControlStyles.ResizeRedraw, true);//空间大小改变时,控件会重绘
//this.SetStyle(ControlStyles.UserPaint ,true );
this.BackColor = Color