tangxu
2025-01-13 4f7cb65b079d88d5a829688b24d26d5145c5df47
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
72
73
74
75
76
77
78
79
80
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace DPumpHydr.WinFrmUI.WenSkin.Controls
{
    public class WenTabHeader : WenControl
    {
        public WenTabHeader() : base()
        {
            Height = 25;
        }
 
        #region 私有属性
 
        private ListTabPage pages;
 
        #endregion
 
        #region 公有属性
 
        [Category("Wen"), Description("尺寸大小"), DefaultValue(typeof(Size), "300,25")]
        public new Size Size { get => base.Size; set => base.Size = value; }
 
        #endregion
 
        #region 子类 标签页面
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public ListTabPage Pages => pages ??= new ListTabPage(this);
        public class ListTabPage : List<TabPage>
        {
            private WenTabHeader owner;
            public ListTabPage(WenTabHeader owner)
            {
                this.owner = owner;
            }
        }
 
        public class TabPage
        {
            public string Text { get; set; }
            public int Width { get; set; }
 
 
 
        }
 
        #endregion
 
        #region 重绘
 
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
 
            Graphics g = e.Graphics.SetGDIHigh();
 
            RectangleF rec = new RectangleF(0, 0, 0, 0);
            //画图形
            foreach (var item in Pages)
            {
                rec = new RectangleF(rec.X + rec.Width + 2, 0, item.Width, this.Height);
 
                g.DrawString(item.Text, this.Font, new SolidBrush(this.ForeColor), rec, ControlHelper.StringConters);
            }
 
        }
 
 
 
 
        #endregion
 
    }
}