tangxu
2024-11-25 0a2c59670b82d61d3fa79f51a54e82e7bd0134c4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#region Imports
 
using System.Drawing;
using System.Drawing.Drawing2D;
 
#endregion
 
namespace DPumpHydr.WinFrmUI.RLT.Util
{
    #region ThunderUtil
 
    public enum MouseStateThunder : byte
    {
        None = 0,
        Over = 1,
        Down = 2,
        Block = 3,
    }
 
    public static class DrawThunder
    {
        public static GraphicsPath RoundRect(Rectangle rect, int Curve)
        {
            GraphicsPath P = new();
            int ArcRectWidth = Curve * 2;
            P.AddArc(new Rectangle(rect.X, rect.Y, ArcRectWidth, ArcRectWidth), -180, 90);
            P.AddArc(new Rectangle(rect.Width - ArcRectWidth + rect.X, rect.Y, ArcRectWidth, ArcRectWidth), -90, 90);
            P.AddArc(new Rectangle(rect.Width - ArcRectWidth + rect.X, rect.Height - ArcRectWidth + rect.Y, ArcRectWidth, ArcRectWidth), 0, 90);
            P.AddArc(new Rectangle(rect.X, rect.Height - ArcRectWidth + rect.Y, ArcRectWidth, ArcRectWidth), 90, 90);
            P.AddLine(new Point(rect.X, rect.Height - ArcRectWidth + rect.Y), new Point(rect.X, Curve + rect.Y));
            return P;
        }
 
        public static GraphicsPath RoundRect(int X, int Y, int Width, int Height, int Curve)
        {
            return RoundRect(new Rectangle(X, Y, Width, Height), Curve);
        }
    }
 
    #endregion
}