zoukankan      html  css  js  c++  java
  • c#圆角窗体

     public void SetWindowRegion()
            {
                System.Drawing.Drawing2D.GraphicsPath FormPath;
                FormPath = new System.Drawing.Drawing2D.GraphicsPath();
                Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);
                FormPath = WinGetRoundedRectPath(rect, 15);
                this.Region = new Region(FormPath);
            }
            private GraphicsPath WinGetRoundedRectPath(Rectangle rect, int radius)
            {
                int diameter = radius;
                Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter));
                GraphicsPath path = new GraphicsPath();
                //   左上角   
                path.AddArc(arcRect, 180, 90);
                //   右上角   
                arcRect.X = rect.Right - diameter;
                path.AddArc(arcRect, 270, 90);
                //   右下角   
                arcRect.Y = rect.Bottom - diameter;
                path.AddArc(arcRect, 0, 90);
                //   左下角   
                arcRect.X = rect.Left;
                path.AddArc(arcRect, 90, 90);
                path.CloseFigure();
                return path;
            }
    View Code
  • 相关阅读:
    C++之类和对象
    PHP程序设计基础
    PHP函数和MySQL数据库
    HTML语言基础
    文件和目录1(文件属性和权限)
    文件IO
    查找
    使用tcpdump抓包实例
    导入模块的2种方法
    ansible启用sudo执行命令
  • 原文地址:https://www.cnblogs.com/qingdie/p/3337862.html
Copyright © 2011-2022 走看看