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
65
66
67
68
69
70
71
#region Imports
 
using DPumpHydr.WinFrmUI.RLT.Util;
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.IO;
using System.Windows.Forms;
 
#endregion
 
namespace DPumpHydr.WinFrmUI.RLT.Controls
{
    #region AloneNotice
 
    public class AloneNotice : System.Windows.Forms.TextBox
    {
        private Graphics G;
 
        private readonly string B64;
 
        public Color BorderColor { get; set; } = Color.White;
 
        public AloneNotice()
        {
            B64 = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABL0lEQVQ4T5VT0VGDQBB9e2cBdGBSgTIDEr9MCw7pI0kFtgB9yFiC+KWMmREqMOnAAuDWOfAiudzhyA/svtvH7Xu7BOv5eH2atVKtwbwk0LWGGVyDqLzoRB7e3u/HJTQOdm+PGYjWNuk4ZkIW36RbkzsS7KqiBnB1Usw49DHh8oQEXMfJKhwgAM4/Mw7RIp0NeLG3ScCcR4vVhnTPnVCf9rUZeImTdKnz71VREnBnn5FKzMnX95jA2V6vLufkBQFESTq0WBXsEla7owmcoC6QJMKW2oCUePY5M0lAjK0iBAQ8TBGc2/d7+uvnM/AQNF4Rp4bpiGkRfTb2Gigx12+XzQb3D9JfBGaQzHWm7HS000RJ2i/av5fJjPDZMplErwl1GxDpMTbL1YC5lCwze52/AQFekh7wKBpGAAAAAElFTkSuQmCC";
            DoubleBuffered = true;
            base.Enabled = false;
            base.ReadOnly = true;
            base.BorderStyle = BorderStyle.None;
            Multiline = true;
            BackColor = AloneLibrary.ColorFromHex("#FFFDE8");
            ForeColor = AloneLibrary.ColorFromHex("#B9B595");
            Cursor = Cursors.Default;
        }
 
        protected override void OnCreateControl()
        {
            base.OnCreateControl();
            base.SetStyle(ControlStyles.UserPaint, true);
        }
 
        protected override void OnPaint(PaintEventArgs e)
        {
            G = e.Graphics;
            G.SmoothingMode = SmoothingMode.HighQuality;
            G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
            base.OnPaint(e);
            G.Clear(BorderColor);
            using (SolidBrush solidBrush = new(BackColor))
            {
                using Pen pen = new(BorderColor);
                using SolidBrush solidBrush2 = new(ForeColor);
                using Font font = new("Segoe UI", 9f);
                G.FillPath(solidBrush, AloneLibrary.RoundRect(AloneLibrary.FullRectangle(base.Size, true), 3, AloneLibrary.RoundingStyle.All));
                G.DrawPath(pen, AloneLibrary.RoundRect(AloneLibrary.FullRectangle(base.Size, true), 3, AloneLibrary.RoundingStyle.All));
                G.DrawString(Text, font, solidBrush2, new Point(30, 6));
            }
            using Image image = Image.FromStream(new MemoryStream(Convert.FromBase64String(B64)));
            G.DrawImage(image, new Rectangle(8, checked((int)Math.Round(unchecked((Height / 2.0) - 8.0))), 16, 16));
        }
 
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);
        }
    }
 
    #endregion
}