zoukankan      html  css  js  c++  java
  • Winform制作圆弧panel

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

     public class ArcPanel : Panel
        {
            protected override void OnPaint(PaintEventArgs e)
            {
                Pen pen = new Pen(_borderColor, 1);
                int wdh = 7;
                e.Graphics.DrawLine(pen, new Point(wdh, 0), new Point(this.Width - wdh, 0));//
                e.Graphics.DrawLine(pen, new Point(0, wdh), new Point(0, this.Height - wdh));  //
                e.Graphics.DrawLine(pen, new Point(this.Width-1 , wdh), new Point(this.Width-1 , this.Height - wdh));//
                e.Graphics.DrawLine(pen, new Point(wdh, this.Height-1), new Point(this.Width - wdh, this.Height-1));//
    
                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, new Point(0, 0));
                e.Graphics.DrawImage(imgRightTop, new Point(this.Width - imgRightTop.Width, 0));
                e.Graphics.DrawImage(imgRightBottom, new Point(this.Width - imgRightBottom.Width, this.Height - imgRightBottom.Height));
                e.Graphics.DrawImage(imgLeftBottom, new Point(0, this.Height - imgLeftBottom.Height));
                base.OnPaint(e);
            }
    
            Color _borderColor = Color.FromArgb(207, 207, 207);
            public Color BorderColor
            {
                get
                {
                    return _borderColor;
                }
                set
                {
                    _borderColor = value;
                    this.Invalidate();
                }
            }
        }
  • 相关阅读:
    go 排序sort的使用
    MySQL 创建索引
    jenkins 解决构建成功后进程消失的问题
    go redigo的简单操作
    go 实现struct转map
    MySQL写入用户微信名
    MySQL简单优化
    python 定时修改数据库
    go 实现简单的加权分配
    python 遇到的小坑
  • 原文地址:https://www.cnblogs.com/jieliu726/p/4718311.html
Copyright © 2011-2022 走看看