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

  • 相关阅读:
    获取Spring容器中的Bean
    Log4j 配置 的webAppRootKey参数问题
    关于Eclipse项目中加入jquery.js文件报错(missing semicolon)问题
    SSO(单点登录)
    MySQL拷贝表的几种方式
    Maven的简介
    Maven 的41种骨架功能介绍
    Intellij IDEA 快捷键大全
    nginx基本配置与参数说明
    MYSQL和ORACLE的一些区别
  • 原文地址:https://www.cnblogs.com/zhangpengshou/p/1699840.html
Copyright © 2011-2022 走看看