chenn
2025-04-11 e98de937b28d42493de5dea6365c853d6b412d3c
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#region Imports
 
using DPumpHydr.WinFrmUI.RLT.Enum.Crown;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
 
#endregion
 
namespace DPumpHydr.WinFrmUI.RLT.Docking.Crown
{
    #region CrownDockContentDocking
 
    [ToolboxItem(false)]
    public class CrownDockContent : UserControl
    {
        protected bool _isShowCloseIcon = true;//是否显示关闭图标(tangxu)
        public bool IsShowCloseIcon
        {
            get => _isShowCloseIcon;
            set
            {
                _isShowCloseIcon = value; 
            }
        }
        #region Event Handler Region
 
        public event EventHandler DockTextChanged;
 
        #endregion
 
        #region Field Region
 
        private string _dockText;
        private Image _icon;
 
        #endregion
 
        #region Property Region
 
        [Category("Appearance")]
        [Description("Determines the text that will appear in the content tabs and headers.")]
        public string DockText
        {
            get => _dockText;
            set
            {
                string oldText = _dockText;
 
                _dockText = value;
 
                DockTextChanged?.Invoke(this, null);
 
                Invalidate();
            }
        }
 
        [Category("Appearance")]
        [Description("Determines the icon that will appear in the content tabs and headers.")]
        public Image Icon
        {
            get => _icon;
            set
            {
                _icon = value;
                Invalidate();
            }
        }
 
        [Category("Layout")]
        [Description("Determines the default area of the dock panel this content will be added to.")]
        [DefaultValue(Enum.Crown.DockArea.Document)]
        public DockArea DefaultDockArea { get; set; }
 
        [Category("Behavior")]
        [Description("Determines the key used by this content in the dock serialization.")]
        public string SerializationKey { get; set; }
 
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public CrownDockPanel DockPanel { get; internal set; }
 
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public CrownDockRegion DockRegion { get; internal set; }
 
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public CrownDockGroup DockGroup { get; internal set; }
 
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public DockArea DockArea { get; set; }
 
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public int Order { get; set; }
 
        #endregion
 
        #region Constructor Region
 
        public CrownDockContent()
        {
            BackColor = Color.Transparent; //ThemeProvider.Theme.Colors.GreyBackground;
        }
 
        #endregion
 
        #region Method Region
 
        public virtual void Close()
        {
            if (DockPanel != null)
            {
                DockPanel.RemoveContent(this);
            }
        }
 
        #endregion
 
        #region Event Handler Region
 
        protected override void OnEnter(EventArgs e)
        {
            base.OnEnter(e);
 
            if (DockPanel == null)
            {
                return;
            }
 
            //DockPanel.ActiveContent = this;
        }
 
        #endregion
    }
 
    #endregion
}