zoukankan      html  css  js  c++  java
  • winform重绘窗体成圆角(网上借鉴)

    winform做圆角窗体:

     1 //重绘窗体为圆角
     2         private void frmMain_Paint(object sender, PaintEventArgs e)
     3         {
     4             #region
     5 
     6             List<Point> list = new List<Point>();
     7             int width = this.Width;
     8             int height = this.Height;
     9 
    10             #region 四个圆角
    11 
    12             //左上  
    13             list.Add(new Point(0, 5));
    14             list.Add(new Point(1, 5));
    15             list.Add(new Point(1, 3));
    16             list.Add(new Point(2, 3));
    17             list.Add(new Point(2, 2));
    18             list.Add(new Point(3, 2));
    19             list.Add(new Point(3, 1));
    20             list.Add(new Point(5, 1));
    21             list.Add(new Point(5, 0));
    22 
    23             //右上  
    24             list.Add(new Point(width - 5, 0));
    25             list.Add(new Point(width - 5, 1));
    26             list.Add(new Point(width - 3, 1));
    27             list.Add(new Point(width - 3, 2));
    28             list.Add(new Point(width - 2, 2));
    29             list.Add(new Point(width - 2, 3));
    30             list.Add(new Point(width - 1, 3));
    31             list.Add(new Point(width - 1, 5));
    32             list.Add(new Point(width - 0, 5));
    33 
    34             //右下  
    35             list.Add(new Point(width - 0, height - 5));
    36             list.Add(new Point(width - 1, height - 5));
    37             list.Add(new Point(width - 1, height - 3));
    38             list.Add(new Point(width - 2, height - 3));
    39             list.Add(new Point(width - 2, height - 2));
    40             list.Add(new Point(width - 3, height - 2));
    41             list.Add(new Point(width - 3, height - 1));
    42             list.Add(new Point(width - 5, height - 1));
    43             list.Add(new Point(width - 5, height - 0));
    44 
    45             //左下  
    46             list.Add(new Point(5, height - 0));
    47             list.Add(new Point(5, height - 1));
    48             list.Add(new Point(3, height - 1));
    49             list.Add(new Point(3, height - 2));
    50             list.Add(new Point(2, height - 2));
    51             list.Add(new Point(2, height - 3));
    52             list.Add(new Point(1, height - 3));
    53             list.Add(new Point(1, height - 5));
    54             list.Add(new Point(0, height - 5));
    55             #endregion
    56 
    57             Point[] points = list.ToArray();
    58 
    59             GraphicsPath shape = new GraphicsPath();
    60 
    61             shape.AddPolygon(points);
    62 
    63             this.Region = new System.Drawing.Region(shape);
    64             #endregion
    65         }
  • 相关阅读:
    数据结构:静态查找表
    数据结构:二叉查找树(C语言实现)
    自创open vp n windows步骤
    web application 访问控制
    postman trigger xdebug session in phpstorm
    sql查询学习和实践点滴积累
    如何写一个能在gulp build pipe中任意更改src内容的函数
    使用Virtual Audio Cable软件实现电脑混音支持电脑录音
    webpack学习笔记丁点积累
    centos 7.2 Apache+mysql+php step by step备忘
  • 原文地址:https://www.cnblogs.com/strongZZ/p/4470478.html
Copyright © 2011-2022 走看看