C#自定义控件的外形该怎么绘制
using System;using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace TestLibrary
{
public sealed class MyButton : Control
{
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
drawMyButton(e);
}
private void drawMyButton(PaintEventArgs e)
{
Rectangle r = new Rectangle(this.Location,this.Size);
using (Brush b = new SolidBrush(this.BackColor))
{
e.Graphics.FillEllipse(b, r);
}
}
}
}
为什么我在窗体里创建这个BUTTON,它的外观不是一个圆或者椭圆呢,而是一个矩形