将button按钮绘制成圆形按钮,做状态灯指示(winform)

来源:互联网 发布:中国最新cpi数据 编辑:程序博客网 时间:2024/05/22 16:05

程序初始化的时候:
    先引用

           using System.Drawing.Drawing2D;

 

 

            GraphicsPath myPath = new GraphicsPath();
            myPath.AddEllipse(5, 5,150, 150);

          
            this.button1.Region = new Region(myPath);
            this.button2.Region = new Region(myPath);
            this.button3.Region = new Region(myPath);
            this.button4.Region = new Region(myPath);

原创粉丝点击