Winform制作圆弧panel

原理就是手动去画边框留出四个角 然后绘制四张圆弧的图片到panel上

 public class ArcPanel : Panel
    {
        protected override void OnPaint(PaintEventArgs e)
        {
            Pen pen = );
            ;
            e.Graphics.DrawLine(pen, ), ));//上
            e.Graphics.DrawLine(pen, , wdh), , this.Height - wdh));  //左
            e.Graphics.DrawLine(pen,  , wdh),  , this.Height - wdh));//右
            e.Graphics.DrawLine(pen, ), ));//下 

            Image imgLeftTop = global::WinGPChat.Properties.Resources.jiao01;
            Image imgRightTop = global::WinGPChat.Properties.Resources.jiao03;
            Image imgRightBottom = global::WinGPChat.Properties.Resources.jiao03_04;
            Image imgLeftBottom = global::WinGPChat.Properties.Resources.jiao04;

            e.Graphics.DrawImage(imgLeftTop, , ));
            e.Graphics.DrawImage(imgRightTop, ));
            e.Graphics.DrawImage(imgRightBottom, new Point(this.Width - imgRightBottom.Width, this.Height - imgRightBottom.Height));
            e.Graphics.DrawImage(imgLeftBottom, , this.Height - imgLeftBottom.Height));
            base.OnPaint(e);
        }

        Color _borderColor = Color.FromArgb(, , );
        public Color BorderColor
        {
            get
            {
                return _borderColor;
            }
            set
            {
                _borderColor = value;
                this.Invalidate();
            }
        }
    }
上一篇:Smarty中一些标签的使用


下一篇:excel_VB宏脚本_批量生成点餐宝接受的格式