tangxu
2024-11-04 ebd031e3bed6c1cfddce8fc9b98f7f9e95fb9e32
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace DPumpHydr.WinFrmUI.WenSkin.Controls
{
    public class WenInfoLable : WenControl
    {
        public WenInfoLable() : base()
        {
        }
 
        #region 公有属性
 
        [Category("Wen"), Description("显示文字内容")]
        [Editor(typeof(Design.Editor.TextEditFormUITypeEditor), typeof(UITypeEditor))]
        public override string Text { get => base.Text; set { base.Text = value; this.Invalidate(); } }
        
        [Category("Wen"), Description("提示字符内容")]
        [Editor(typeof(Design.Editor.TextEditFormUITypeEditor), typeof(UITypeEditor))]
        public string TextLable { get; set; }
        #endregion
 
        protected override void WenOnPaint(Graphics g, Rectangle rec, PaintEventArgs e)
        {
            int infoWidth = TextRenderer.MeasureText(TextLable, Font).Width;
 
            Rectangle recinfo = new Rectangle(0, 0, infoWidth+2, Height);
 
            base.WenOnPaint(g, rec, e);
            DrawString(TextLable, g, recinfo);
            DrawString(Text, g, new Rectangle(infoWidth + 2, 0, Width - infoWidth - 2, Height));
        }
    }
}