CommonTools/Util.cs
(开头部分) 12KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Reflection;
namespace CommonTools
{
class Util
{
public static Rectangle Rect(RectangleF rf)
{
Rectangle r = new Rectangle();
r.X = (int)rf.X;
r.Y = (int)rf.Y;
r.Width = (int)rf.Width;
r.Height = (int)rf.Height;
return r;
}
public static RectangleF Rect(Rectangle r)
{
RectangleF rf = new RectangleF();
rf.X = (float)r.X;
rf.Y = (float)r.Y;
rf.Width = (float)r.Width;
rf.Height = (float)r.Height;
return rf;
}
public static Point Point(PointF pf)
{
return new Point((int)pf.X, (int)pf.Y);
}
public static PointF Center(RectangleF r)
{
PointF center = r.Location;
center.X += r.Width / 2;
center.Y += r.Height / 2;
return center;
}
public static void DrawFrame(Graphics dc, RectangleF r, float cornerRadius, Color color)
{
Pen pen = new Pen(color);
if (cornerRadius <= 0)
{
dc.DrawRectangle(pen, Rect(r));
return;
}
cornerRadius = (float)Math.Min(cornerRadius, Math.Floor(r.Width) - 2);
cornerRadius = (float)Math.Min(cornerRadius, Math.Floor(r.Height) - 2);
GraphicsPath path = new GraphicsPath();
path.AddArc(r.X,r.Y, cornerRadius, cornerRadius, 180, 90);
path.AddArc(r.Right-cornerRadius,r.Y, cornerRadius, cornerRadius, 270, 90);
path.AddArc(r.Right-cornerRadius,r.Bottom-cornerRadius, cornerRadius, cornerRadius, 0, 90);
path.AddArc(r.X,r.Bottom-cornerRadius, cornerRadius, cornerRadius, 90, 90);
后面还有 316 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。