C#中创建圆形/按钮(使用重绘)
生活随笔
收集整理的這篇文章主要介紹了
C#中创建圆形/按钮(使用重绘)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
創建圓形按鈕挺簡單的。
?public class EllipseButton : Button
{
protected override void OnPaint(PaintEventArgs pevent)
{
GraphicsPath gPath = new GraphicsPath();
// 繪制橢圓形區域
gPath.AddEllipse(0, 0, this.ClientSize.Width, this.ClientSize.Height);
// 將區域賦值給Region
this.Region = new System.Drawing.Region(gPath);
base.OnPaint(pevent);
}
}
?
總結
以上是生活随笔為你收集整理的C#中创建圆形/按钮(使用重绘)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 解决:vue.esm.js?efeb:5
- 下一篇: 一行代码 实现集合去重