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

  • 相关阅读:
    Unity shader 代码高亮+提示
    PTA --- L2-003 月饼
    PTA --- L2-002 链表去重
    计蒜客 —— 字符串p型编码
    计蒜客 —— 最好的草
    最近忙科研立项 & 对博客的优化
    计蒜客 —— 删除单词后缀
    Tensorflow 保存模型 & 在java中调用
    Tensorflow 用训练好的模型预测
    Tensorflow 保存和载入训练过程
  • 原文地址:https://www.cnblogs.com/zhangpengshou/p/1699840.html
Copyright © 2011-2022 走看看