Eabei.GoBangGame/Eabei.Controls/Global.cs

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


/********************************
*  命名空间: Eabei.Controls
*  
*  功    能: N/A
*  类    名: Global
*  
*  作    者: EB
*  创建日期: 2022/7/1 12:40:25
*********************************/

namespace Eabei.Controls
{
    public class Global : Common.SingleInstance<Global>
    {
        #region 自定义方法
        /// <summary>
        /// 绘制圆角边框
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="color"></param>
        /// <param name="rect"></param>
        /// <param name="cRadius"></param>
        public void DrawRadiusRectangle(Graphics graphics, Color color, Rectangle rect, int cRadius)
        {
            if (cRadius <= 0)
            {
                graphics.DrawRectangle(new Pen(color), rect);
                return;
            }
            if (rect.Height < cRadius * 2)
                cRadius = Math.Max(1, rect.Height / 2);
            // 指定图形路径, 有一系列 直线/曲线 组成
            GraphicsPath myPath = new GraphicsPath();
            myPath.StartFigure();
            myPath.AddArc(new Rectangle(new Point(rect.X, rect.Y), new Size(2 * cRadius, 2 * cRadius)), 180, 90);
            myPath.AddLine(new Point(rect.X + cRadius, rect.Y), new Point(rect.Right - cRadius, rect.Y));
            myPath.AddArc(new Rectangle(new Point(rect.Right - 2 * cRadius, rect.Y), new Size(2 * cRadius, 2 * cRadius)), 270, 90);
            myPath.AddLine(new Point(rect.Right, rect.Y + cRadius), new Point(rect.Right, rect.Bottom - cRadius));
            myPath.AddArc(new Rectangle(new Point(rect.Right - 2 * cRadius, rect.Bottom - 2 * cRadius), new Size(2 * cRadius, 2 * cRadius)), 0, 90);
            myPath.AddLine(new Point(rect.Right - cRadius, rect.Bottom), new Point(rect.X + cRadius, rect.Bottom));
            myPath.AddArc(new Rectangle(new Point(rect.X, rect.Bottom - 2 * cRadius), new Size(2 * cRadius, 2 * cRadius)), 90, 90);
            myPath.AddLine(new Point(rect.X, rect.Bottom - cRadius), new Point(rect.X, rect.Y + cRadius));
            myPath.CloseFigure();
            graphics.DrawPath(new Pen(color), myPath);
        }

        /// <summary>
        /// 填充圆角边框
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="color"></param>
        /// <param name="rect"></param>
后面还有 152 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。