C#自定义圆角按钮后,按钮上的text无法显示在按钮上

ANDREGAO0815 ANDREGAO0815 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;

namespace CustomerUI
{
public partial class RundEckelButton : Button
{
private int radius; //半径

[CategoryAttribute("布局"), BrowsableAttribute(true), ReadOnlyAttribute(false)]
public int Radius
{
set
{
radius = value;
}
get
{
return radius;
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaintBackground(e);
GraphicsPath path = new GraphicsPath();
path.AddArc(0, 0, radius, radius, 180f, 90f);
path.AddArc(this.Width - radius-1, 0, radius, radius, 270f, 90f);
path.AddArc(this.Width-radius-1, this.Height - radius-1, radius, radius, 0f, 90f);
path.AddArc(0 , this.Height - radius-1, radius, radius, 90f, 90f);
path.CloseFigure();
this.Region = new System.Drawing.Region(path);

}

public RundEckelButton()
{
radius = 10;
this.FlatStyle = FlatStyle;
this.FlatAppearance.BorderSize = 1;
}

private void RundEckelButton_Load(object sender, EventArgs e)
{

}
}
}
...全文

相关推荐

评论 1
收藏 已收藏
分享
返回顶部
ANDREGAO0815
.NET Framework 17,748 成员 24,324 内容