tangxu
2024-12-16 23fadc9cb0c09b665a1bbcef7eaf16f916045dc4
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#region Imports
 
using DPumpHydr.WinFrmUI.RLT.Util;
using System;
using System.Drawing;
using System.Windows.Forms;
 
#endregion
 
namespace DPumpHydr.WinFrmUI.RLT.Controls
{
    #region NightLinkLabel
 
    public class NightLinkLabel : LinkLabel
    {
        #region Fields
 
        private readonly Cursor NativeHand;
 
        #endregion
 
        public NightLinkLabel()
        {
            Font = new("Segoe UI", 9, FontStyle.Regular);
            BackColor = Color.Transparent;
            LinkColor = ColorTranslator.FromHtml("#F25D59"); ;
            ActiveLinkColor = ColorTranslator.FromHtml("#DE5954");
            VisitedLinkColor = ColorTranslator.FromHtml("#FE5954");
            LinkBehavior = LinkBehavior.HoverUnderline;
            Cursor = Cursors.Hand;
 
            NativeHand = new Cursor(NativeMethods.LoadCursor(IntPtr.Zero, NativeConstants.IDC_HAND));
        }
 
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            Focus();
        }
 
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
 
            if (OverrideCursor == Cursors.Hand)
            {
                OverrideCursor = NativeHand;
            }
        }
 
        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);
            OverrideCursor = null;
        }
 
        protected override void OnInvalidated(InvalidateEventArgs e)
        {
            base.OnInvalidated(e);
        }
    }
 
    #endregion
}