zoukankan      html  css  js  c++  java
  • C#绘制圆角矩形

     #region 绘制圆角矩形区域

            internal static GraphicsPath CreateRoundedRectanglePath(Rectangle rect, int cornerRadius)
            {
                GraphicsPath roundedRect = new GraphicsPath();
                roundedRect.AddArc(rect.X, rect.Y, cornerRadius * 2, cornerRadius * 2, 180, 90);
                roundedRect.AddLine(rect.X + cornerRadius, rect.Y, rect.Right - cornerRadius * 2, rect.Y);
                roundedRect.AddArc(rect.X + rect.Width - cornerRadius * 2, rect.Y, cornerRadius * 2, cornerRadius * 2, 270, 90);
                roundedRect.AddLine(rect.Right, rect.Y + cornerRadius * 2, rect.Right, rect.Y + rect.Height - cornerRadius * 2);
                roundedRect.AddArc(rect.X + rect.Width - cornerRadius * 2, rect.Y + rect.Height - cornerRadius * 2, cornerRadius * 2, cornerRadius * 2, 0, 90);
                roundedRect.AddLine(rect.Right - cornerRadius * 2, rect.Bottom, rect.X + cornerRadius * 2, rect.Bottom);
                roundedRect.AddArc(rect.X, rect.Bottom - cornerRadius * 2, cornerRadius * 2, cornerRadius * 2, 90, 90);
                roundedRect.AddLine(rect.X, rect.Bottom - cornerRadius * 2, rect.X, rect.Y + cornerRadius * 2);
                roundedRect.CloseFigure();
                return roundedRect;
            }

            #endregion

  • 相关阅读:
    5.不用拷贝的对象可以用ref
    4.bind绑定
    3.bind与仿函数以及普通函数
    35.自己实现vector模板库myvector
    2.boost遍历数组容器
    1.boost库的安装
    34.share_ptr智能指针共享内存,引用计数
    33.unique_ptr独享内存智能指针
    32.智能指针auto_ptr
    131.typename在嵌套类中的作用
  • 原文地址:https://www.cnblogs.com/zhangpengshou/p/1699840.html
Copyright © 2011-2022 走看看