tangxu
2025-02-10 e40718947b5aa9205c87a7478aa86c37a82e0510
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
#region Imports
 
using System.Drawing;
using System.Windows.Forms;
using static DPumpHydr.WinFrmUI.RLT.Helper.CrownHelper;
 
#endregion
 
namespace DPumpHydr.WinFrmUI.RLT.Controls
{
    #region CrownTitle
 
    public class CrownTitle : Label
    {
        #region Constructor Region
 
        public CrownTitle()
        {
            //
        }
 
        #endregion
 
        #region Paint Region
 
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            Rectangle rect = new(0, 0, ClientSize.Width, ClientSize.Height);
 
            using (SolidBrush b = new(ThemeProvider.Theme.Colors.GreyBackground))
            {
                g.FillRectangle(b, rect);
            }
 
            SizeF textSize = g.MeasureString(Text, Font);
 
            using (SolidBrush b = new(ThemeProvider.Theme.Colors.LightText))
            {
                g.DrawString(Text, Font, b, new PointF(-2, 0));
            }
 
            using Pen p = new(ThemeProvider.Theme.Colors.GreyHighlight);
            PointF p1 = new(textSize.Width + 5, textSize.Height / 2);
            PointF p2 = new(rect.Width, textSize.Height / 2);
            g.DrawLine(p, p1, p2);
        }
 
        #endregion
    }
 
    #endregion
}