using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Datebanging
{
class Buttond:Button
{
protected override void OnPaint(PaintEventArgs e)
{
// 计算圆的直径
int diameter = Math.Min(ClientSize.Width-10, ClientSize.Height-10);
// 计算圆的位置使其居中
int x = (ClientSize.Width - diameter) / 2;
int y = (ClientSize.Height - diameter) / 2;
// 创建圆形路径
GraphicsPath graphicsPath = new GraphicsPath();
graphicsPath.AddEllipse(x, y, diameter, diameter);
this.Region = new Region(graphicsPath);
base.OnPaint(e);
}
}
}