用像素点画圆
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
Point point = new Point();
point.X = this.Size.Width/2;
point.Y=this.Size.Height/2;
DrawCircle(2, point, g, new Pen(Color.Blue));
DrawCircle(50, point, g, new Pen(Color.Black));
base.OnPaint(e);
}
/// <summary>
/// 自定义画圆
/// </summary>
/// <param name="g">画布</param>
/// <param name="r">圆半径</param>
/// <param name="point">圆心位置</param>
private void DrawCircle( int r, Point point,Graphics g,Pen pen)
{
Rectangle rect = new Rectangle();
rect.X=point.X - r;
rect.Y=point.Y - r;
rect.Size = new Size(2 * r, 2 * r);
g.DrawEllipse(pen, rect);
}