diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe
index 578e0e7c..5d059528 100644
Binary files a/Bin/net40/SunnyUI.Demo.exe and b/Bin/net40/SunnyUI.Demo.exe differ
diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll
index 59a42bb4..87522046 100644
Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ
diff --git a/SunnyUI.Demo/Controls/FSplitContainer.cs b/SunnyUI.Demo/Controls/FSplitContainer.cs
new file mode 100644
index 00000000..fcda47bd
--- /dev/null
+++ b/SunnyUI.Demo/Controls/FSplitContainer.cs
@@ -0,0 +1,50 @@
+using Sunny.UI;
+using System.Windows.Forms;
+
+namespace SunnyUI.VIP.Demo
+{
+ public partial class FSplitContainer : UIPage
+ {
+ public FSplitContainer()
+ {
+ InitializeComponent();
+
+ uiNavMenuEx1.AddNodeRightSymbol(uiNavMenuEx1.Nodes[0], 61452);
+ uiNavMenuEx1.AddNodeRightSymbol(uiNavMenuEx1.Nodes[0], 61453);
+
+ uiNavMenuEx1.AddNodeRightSymbol(uiNavMenuEx1.Nodes[1], 61454);
+ uiNavMenuEx1.AddNodeRightSymbol(uiNavMenuEx1.Nodes[1], 61450);
+
+ uiNavMenuEx1.AddNodeRightSymbol(uiNavMenuEx1.Nodes[0].Nodes[0], 61452);
+ uiNavMenuEx1.AddNodeRightSymbol(uiNavMenuEx1.Nodes[0].Nodes[0], 61453);
+
+ uiNavMenuEx1.AddNodeRightSymbol(uiNavMenuEx1.Nodes[0].Nodes[2], 61452);
+ uiNavMenuEx1.AddNodeRightSymbol(uiNavMenuEx1.Nodes[0].Nodes[2], 61453);
+
+ uiNavMenuEx1.AddNodeRightSymbol(uiNavMenuEx1.Nodes[3], 61450);
+
+ //uiNavMenuEx1.SetNodeSymbol(uiNavMenuEx1.Nodes[0], 61450);
+ uiNavMenuEx1.SetNodeImageIndex(uiNavMenuEx1.Nodes[0], 1);
+ }
+
+ private void uiSplitContainer1_SplitterMoved(object sender, SplitterEventArgs e)
+ {
+
+ }
+
+ private void uiSymbolButton1_Click(object sender, System.EventArgs e)
+ {
+
+ }
+
+ private void uiNavMenuEx1_NodeRightSymbolClick(object sender, TreeNode node, int index, int symbol)
+ {
+ uiListBox1.Items.Add(node.Text + ", " + index + ", " + symbol);
+ }
+
+ private void uiButton1_Click(object sender, System.EventArgs e)
+ {
+ uiListBox1.Items.Clear();
+ }
+ }
+}
diff --git a/SunnyUI.Demo/Controls/FSplitContainer.designer.cs b/SunnyUI.Demo/Controls/FSplitContainer.designer.cs
new file mode 100644
index 00000000..85fa076b
--- /dev/null
+++ b/SunnyUI.Demo/Controls/FSplitContainer.designer.cs
@@ -0,0 +1,210 @@
+
+namespace SunnyUI.VIP.Demo
+{
+ partial class FSplitContainer
+ {
+ ///
+ /// 必需的设计器变量。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 清理所有正在使用的资源。
+ ///
+ /// 如果应释放托管资源,为 true;否则为 false。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows 窗体设计器生成的代码
+
+ ///
+ /// 设计器支持所需的方法 - 不要修改
+ /// 使用代码编辑器修改此方法的内容。
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("节点4");
+ System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("节点5");
+ System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("节点6");
+ System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("节点0", new System.Windows.Forms.TreeNode[] {
+ treeNode1,
+ treeNode2,
+ treeNode3});
+ System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("节点1");
+ System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("节点2");
+ System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("节点3");
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FSplitContainer));
+ this.uiSplitContainer1 = new Sunny.UI.UISplitContainer();
+ this.uiNavMenuEx1 = new Sunny.UI.UINavMenu();
+ this.imageList1 = new System.Windows.Forms.ImageList(this.components);
+ this.uiSplitContainer2 = new Sunny.UI.UISplitContainer();
+ this.uiListBox1 = new Sunny.UI.UIListBox();
+ this.uiButton1 = new Sunny.UI.UIButton();
+ ((System.ComponentModel.ISupportInitialize)(this.uiSplitContainer1)).BeginInit();
+ this.uiSplitContainer1.Panel1.SuspendLayout();
+ this.uiSplitContainer1.Panel2.SuspendLayout();
+ this.uiSplitContainer1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.uiSplitContainer2)).BeginInit();
+ this.uiSplitContainer2.Panel1.SuspendLayout();
+ this.uiSplitContainer2.Panel2.SuspendLayout();
+ this.uiSplitContainer2.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // uiSplitContainer1
+ //
+ this.uiSplitContainer1.Cursor = System.Windows.Forms.Cursors.Default;
+ this.uiSplitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.uiSplitContainer1.Location = new System.Drawing.Point(0, 35);
+ this.uiSplitContainer1.Name = "uiSplitContainer1";
+ //
+ // uiSplitContainer1.Panel1
+ //
+ this.uiSplitContainer1.Panel1.Controls.Add(this.uiNavMenuEx1);
+ //
+ // uiSplitContainer1.Panel2
+ //
+ this.uiSplitContainer1.Panel2.Controls.Add(this.uiSplitContainer2);
+ this.uiSplitContainer1.Size = new System.Drawing.Size(800, 415);
+ this.uiSplitContainer1.SplitterDistance = 266;
+ this.uiSplitContainer1.SplitterWidth = 11;
+ this.uiSplitContainer1.TabIndex = 0;
+ //
+ // uiNavMenuEx1
+ //
+ this.uiNavMenuEx1.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.uiNavMenuEx1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.uiNavMenuEx1.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawAll;
+ this.uiNavMenuEx1.ExpandSelectFirst = true;
+ this.uiNavMenuEx1.Font = new System.Drawing.Font("微软雅黑", 12F);
+ this.uiNavMenuEx1.FullRowSelect = true;
+ this.uiNavMenuEx1.ImageIndex = 0;
+ this.uiNavMenuEx1.ImageList = this.imageList1;
+ this.uiNavMenuEx1.ItemHeight = 50;
+ this.uiNavMenuEx1.Location = new System.Drawing.Point(0, 0);
+ this.uiNavMenuEx1.MenuStyle = Sunny.UI.UIMenuStyle.Custom;
+ this.uiNavMenuEx1.Name = "uiNavMenuEx1";
+ treeNode1.Name = "节点4";
+ treeNode1.Text = "节点4";
+ treeNode2.Name = "节点5";
+ treeNode2.Text = "节点5";
+ treeNode3.Name = "节点6";
+ treeNode3.Text = "节点6";
+ treeNode4.Name = "节点0";
+ treeNode4.Text = "节点0";
+ treeNode5.Name = "节点1";
+ treeNode5.Text = "节点1";
+ treeNode6.Name = "节点2";
+ treeNode6.Text = "节点2";
+ treeNode7.Name = "节点3";
+ treeNode7.Text = "节点3";
+ this.uiNavMenuEx1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
+ treeNode4,
+ treeNode5,
+ treeNode6,
+ treeNode7});
+ this.uiNavMenuEx1.SelectedImageIndex = 0;
+ this.uiNavMenuEx1.ShowLines = false;
+ this.uiNavMenuEx1.Size = new System.Drawing.Size(266, 415);
+ this.uiNavMenuEx1.Style = Sunny.UI.UIStyle.Custom;
+ this.uiNavMenuEx1.TabIndex = 0;
+ this.uiNavMenuEx1.NodeRightSymbolClick += new Sunny.UI.UINavMenu.OnNodeRightSymbolClick(this.uiNavMenuEx1_NodeRightSymbolClick);
+ //
+ // imageList1
+ //
+ this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
+ this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
+ this.imageList1.Images.SetKeyName(0, "Add_16x16.png");
+ this.imageList1.Images.SetKeyName(1, "AddFooter_16x16.png");
+ this.imageList1.Images.SetKeyName(2, "AddGroupFooter_16x16.png");
+ this.imageList1.Images.SetKeyName(3, "AddGroupHeader_16x16.png");
+ //
+ // uiSplitContainer2
+ //
+ this.uiSplitContainer2.CollapsePanel = Sunny.UI.UISplitContainer.UICollapsePanel.Panel2;
+ this.uiSplitContainer2.Cursor = System.Windows.Forms.Cursors.Default;
+ this.uiSplitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.uiSplitContainer2.Location = new System.Drawing.Point(0, 0);
+ this.uiSplitContainer2.Name = "uiSplitContainer2";
+ this.uiSplitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ //
+ // uiSplitContainer2.Panel1
+ //
+ this.uiSplitContainer2.Panel1.Controls.Add(this.uiListBox1);
+ //
+ // uiSplitContainer2.Panel2
+ //
+ this.uiSplitContainer2.Panel2.Controls.Add(this.uiButton1);
+ this.uiSplitContainer2.Size = new System.Drawing.Size(523, 415);
+ this.uiSplitContainer2.SplitterDistance = 244;
+ this.uiSplitContainer2.SplitterWidth = 11;
+ this.uiSplitContainer2.TabIndex = 0;
+ //
+ // uiListBox1
+ //
+ this.uiListBox1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.uiListBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
+ this.uiListBox1.FormatString = "";
+ this.uiListBox1.ItemSelectForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
+ this.uiListBox1.Location = new System.Drawing.Point(0, 0);
+ this.uiListBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
+ this.uiListBox1.MinimumSize = new System.Drawing.Size(1, 1);
+ this.uiListBox1.Name = "uiListBox1";
+ this.uiListBox1.Padding = new System.Windows.Forms.Padding(2);
+ this.uiListBox1.Size = new System.Drawing.Size(523, 244);
+ this.uiListBox1.TabIndex = 0;
+ this.uiListBox1.Text = "uiListBox1";
+ //
+ // uiButton1
+ //
+ this.uiButton1.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.uiButton1.Font = new System.Drawing.Font("微软雅黑", 12F);
+ this.uiButton1.Location = new System.Drawing.Point(29, 29);
+ this.uiButton1.MinimumSize = new System.Drawing.Size(1, 1);
+ this.uiButton1.Name = "uiButton1";
+ this.uiButton1.Size = new System.Drawing.Size(100, 35);
+ this.uiButton1.TabIndex = 0;
+ this.uiButton1.Text = "清除";
+ this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click);
+ //
+ // FSplitContainer
+ //
+ this.AllowShowTitle = true;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.uiSplitContainer1);
+ this.Name = "FSplitContainer";
+ this.Padding = new System.Windows.Forms.Padding(0, 35, 0, 0);
+ this.ShowTitle = true;
+ this.Symbol = 361512;
+ this.Text = "SplitContainer";
+ this.uiSplitContainer1.Panel1.ResumeLayout(false);
+ this.uiSplitContainer1.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.uiSplitContainer1)).EndInit();
+ this.uiSplitContainer1.ResumeLayout(false);
+ this.uiSplitContainer2.Panel1.ResumeLayout(false);
+ this.uiSplitContainer2.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.uiSplitContainer2)).EndInit();
+ this.uiSplitContainer2.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private Sunny.UI.UISplitContainer uiSplitContainer1;
+ private Sunny.UI.UISplitContainer uiSplitContainer2;
+ private Sunny.UI.UINavMenu uiNavMenuEx1;
+ private Sunny.UI.UIListBox uiListBox1;
+ private Sunny.UI.UIButton uiButton1;
+ private System.Windows.Forms.ImageList imageList1;
+ }
+}
+
diff --git a/SunnyUI.Demo/Controls/FSplitContainer.resx b/SunnyUI.Demo/Controls/FSplitContainer.resx
new file mode 100644
index 00000000..0626521c
--- /dev/null
+++ b/SunnyUI.Demo/Controls/FSplitContainer.resx
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+
+ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
+ LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
+ ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAC+
+ CQAAAk1TRnQBSQFMAgEBBAEAARgBAAEYAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
+ AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
+ AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
+ AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
+ AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgM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/BZEB/wazAgAB7AH/BbMB/waRAgAB7Ar/
+ AewJAAKzCQAB7AH/BZED/wKzBAAB7AH/BbMD/wKRBAAB7AH/CLsB/wHsCQACswkAAewJ/wKzBAAB7An/
+ ApEEAAHsCv8B7AMADrMDAAHsAf8HuwP/BAAB7AH/B7sD/wQAAewB/wi7Af8B7AMADrMDAAHsCv8B7AQA
+ AewK/wHsBAAB7Ar/AewJAAKzCQAB7AH/CLsB/wHsBAAB7AH/CLsB/wHsBAAB7AH/B7sD/wkAArMJAAHs
+ Cv8B7AQAAewK/wHsBAAB7An/ApEJAAKzCQAB7AH/CLsB/wHsBAAB7AH/CLsB/wHsBAAB7AH/BbMD/wKR
+ CQACswkAAewK/wHsBAAB7Ar/AewEAAHsAf8FswH/BpEHAAKzCQAB7AH/CLsB/wHsBAAB7AH/CLsB/wHs
+ BAAB7AH/BbMB/waRBwACswkAAewK/wHsBAAB7Ar/AewEAAHsCf8CkRQADOwEAAzsBAAJ7AH/ApECAAFC
+ AU0BPgcAAT4DAAEoAwABQAMAASADAAEBAQABAQYAAQEWAAP/gQAI/wH+AX8BwAEDAcABAwHAAQMB/gF/
+ AcABAwHAAQMBwAEDAf4BfwHAAQABwAEAAcABAwH+AX8BwAEAAcABAAHAAQMB/gF/AcABAwHAAQMBwAED
+ Af4BfwHAAQMBwAEDAcABAwGAAQEBwAEDAcABAwHAAQMBgAEBAcABAwHAAQMBwAEDAf4BfwHAAQMBwAED
+ AcABAwH+AX8BwAEDAcABAwHAAQMB/gF/AcABAwHAAQMBwAEDAf4BfwHAAQMBwAEDAcABAAH+AX8BwAED
+ AcABAwHAAQAB/gF/AcABAwHAAQMBwAEDAv8BwAEDAcABAwHAAQML
+
+
+
\ No newline at end of file
diff --git a/SunnyUI.Demo/FMain.cs b/SunnyUI.Demo/FMain.cs
index 94f85f40..93f188a3 100644
--- a/SunnyUI.Demo/FMain.cs
+++ b/SunnyUI.Demo/FMain.cs
@@ -1,4 +1,5 @@
-using System;
+using SunnyUI.VIP.Demo;
+using System;
using System.Drawing;
using System.Windows.Forms;
@@ -30,6 +31,7 @@ namespace Sunny.UI.Demo
Aside.CreateChildNode(parent, AddPage(new FProcess(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FRadioButton(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FScrollBar(), ++pageIndex));
+ Aside.CreateChildNode(parent, AddPage(new FSplitContainer(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FTabControl(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FTextBox(), ++pageIndex));
Aside.CreateChildNode(parent, AddPage(new FTransfer(), ++pageIndex));
diff --git a/SunnyUI.Demo/SunnyUI.Demo.csproj b/SunnyUI.Demo/SunnyUI.Demo.csproj
index cbc86a81..4bbcc0b5 100644
--- a/SunnyUI.Demo/SunnyUI.Demo.csproj
+++ b/SunnyUI.Demo/SunnyUI.Demo.csproj
@@ -125,6 +125,12 @@
FLine.cs
+
+ Form
+
+
+ FSplitContainer.cs
+
Form
@@ -401,6 +407,9 @@
FLine.cs
+
+ FSplitContainer.cs
+
FLight.cs
diff --git a/SunnyUI/Controls/UISplitContainer.cs b/SunnyUI/Controls/UISplitContainer.cs
new file mode 100644
index 00000000..b643c255
--- /dev/null
+++ b/SunnyUI/Controls/UISplitContainer.cs
@@ -0,0 +1,532 @@
+/******************************************************************************
+ * SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
+ * CopyRight (C) 2012-2021 ShenYongHua(沈永华).
+ * QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
+ *
+ * Blog: https://www.cnblogs.com/yhuse
+ * Gitee: https://gitee.com/yhuse/SunnyUI
+ * GitHub: https://github.com/yhuse/SunnyUI
+ *
+ * SunnyUI.dll can be used for free under the GPL-3.0 license.
+ * If you use this code, please keep this note.
+ * 如果您使用此代码,请保留此说明。
+ ******************************************************************************
+ * 文件名称: UISplitContainer.cs
+ * 文件说明: 分割容器
+ * 当前版本: V3.0
+ * 创建日期: 2021-10-30
+ *
+ * 2021-10-30: V3.0.8 增加文件说明
+******************************************************************************/
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace Sunny.UI
+{
+ public class UISplitContainer : SplitContainer
+ {
+ private enum UIMouseType
+ {
+ None,
+ Button,
+ Split
+ }
+
+ private enum UISplitPanelState
+ {
+ Collapsed = 0,
+ Expanded = 1,
+ }
+
+ private enum UIControlState
+ {
+ ///
+ /// 正常。
+ ///
+ Normal,
+ ///
+ /// 鼠标进入。
+ ///
+ Hover,
+ }
+
+ public enum UICollapsePanel
+ {
+ None = 0,
+ Panel1 = 1,
+ Panel2 = 2,
+ }
+
+ private UICollapsePanel _collapsePanel = UICollapsePanel.Panel1;
+ private UISplitPanelState _splitPanelState = UISplitPanelState.Expanded;
+ private UIControlState _uiControlState;
+ private int _lastDistance;
+ private int _minSize;
+ private UIMouseType _uiMouseType;
+ private readonly object EventCollapseClick = new object();
+
+ public UISplitContainer()
+ {
+ SetStyle(ControlStyles.UserPaint |
+ ControlStyles.AllPaintingInWmPaint |
+ ControlStyles.OptimizedDoubleBuffer, true);
+ _lastDistance = SplitterDistance;
+ SplitterWidth = 10;
+ }
+
+ private Color barColor = Color.FromArgb(56, 56, 56);
+
+ [DefaultValue(typeof(Color), "56, 56, 56"), Category("SunnyUI")]
+ [Description("分割栏背景色")]
+ public Color BarColor
+ {
+ get => barColor;
+ set
+ {
+ barColor = value;
+ Invalidate();
+ }
+ }
+
+ private Color handleColor = Color.FromArgb(106, 106, 106);
+
+ [DefaultValue(typeof(Color), "106, 106, 106"), Category("SunnyUI")]
+ [Description("分割栏按钮背景色")]
+ public Color HandleColor
+ {
+ get => handleColor;
+ set
+ {
+ handleColor = value;
+ Invalidate();
+ }
+ }
+
+ private Color handleHoverColor = Color.FromArgb(186, 186, 186);
+
+ [DefaultValue(typeof(Color), "186, 186, 186"), Category("SunnyUI")]
+ [Description("分割栏按钮鼠标移上背景色")]
+ public Color HandleHoverColor
+ {
+ get => handleHoverColor;
+ set
+ {
+ handleHoverColor = value;
+ Invalidate();
+ }
+ }
+
+ private Color arrowColor = Color.FromArgb(80, 160, 255);
+
+ [DefaultValue(typeof(Color), "80, 160, 255"), Category("SunnyUI")]
+ [Description("分割栏按钮箭头背景色")]
+ public Color ArrowColor
+ {
+ get => arrowColor;
+ set
+ {
+ arrowColor = value;
+ Invalidate();
+ }
+ }
+
+ public event EventHandler CollapseClick
+ {
+ add => Events.AddHandler(EventCollapseClick, value);
+ remove => Events.RemoveHandler(EventCollapseClick, value);
+ }
+
+ [DefaultValue(UICollapsePanel.Panel1), Category("SunnyUI")]
+ [Description("点击后收起的Panel")]
+ public UICollapsePanel CollapsePanel
+ {
+ get => _collapsePanel;
+ set
+ {
+ if (_collapsePanel != value)
+ {
+ Expand();
+ _collapsePanel = value;
+ Invalidate();
+ }
+ }
+ }
+
+ protected virtual int DefaultCollapseWidth => 80;
+
+ protected virtual int DefaultArrowWidth => 24;
+
+ private Rectangle CollapseRect
+ {
+ get
+ {
+ if (_collapsePanel == UICollapsePanel.None)
+ {
+ return Rectangle.Empty;
+ }
+
+ Rectangle rect = SplitterRectangle;
+ if (Orientation == Orientation.Horizontal)
+ {
+ rect.X = (Width - DefaultCollapseWidth) / 2;
+ rect.Width = DefaultCollapseWidth;
+ }
+ else
+ {
+ rect.Y = (Height - DefaultCollapseWidth) / 2;
+ rect.Height = DefaultCollapseWidth;
+ }
+
+ return rect;
+ }
+ }
+
+ private UISplitPanelState SplitPanelState
+ {
+ get => _splitPanelState;
+ set
+ {
+ if (_splitPanelState != value)
+ {
+ switch (value)
+ {
+ case UISplitPanelState.Expanded:
+ Expand();
+ break;
+ case UISplitPanelState.Collapsed:
+ Collapse();
+ break;
+
+ }
+
+ _splitPanelState = value;
+ }
+ }
+ }
+
+ private UIControlState ControlState
+ {
+ set
+ {
+ if (_uiControlState != value)
+ {
+ _uiControlState = value;
+ Invalidate(CollapseRect);
+ }
+ }
+ }
+
+ public void Collapse()
+ {
+ if (_collapsePanel != UICollapsePanel.None && SplitPanelState == UISplitPanelState.Expanded)
+ {
+ _lastDistance = SplitterDistance;
+ if (_collapsePanel == UICollapsePanel.Panel1)
+ {
+ _minSize = Panel1MinSize;
+ Panel1MinSize = 0;
+ SplitterDistance = 0;
+ }
+ else
+ {
+ int width = Orientation == Orientation.Horizontal ?
+ Height : Width;
+ _minSize = Panel2MinSize;
+ Panel2MinSize = 0;
+ SplitterDistance = width - SplitterWidth - Padding.Vertical;
+ }
+
+ Invalidate(SplitterRectangle);
+ }
+ }
+
+ public void Expand()
+ {
+ if (_collapsePanel != UICollapsePanel.None &&
+ SplitPanelState == UISplitPanelState.Collapsed)
+ {
+ if (_collapsePanel == UICollapsePanel.Panel1)
+ {
+ Panel1MinSize = _minSize;
+ }
+ else
+ {
+ Panel2MinSize = _minSize;
+ }
+
+ SplitterDistance = _lastDistance;
+ Invalidate(SplitterRectangle);
+ }
+ }
+
+ protected virtual void OnCollapseClick(EventArgs e)
+ {
+ SplitPanelState = SplitPanelState == UISplitPanelState.Collapsed ?
+ UISplitPanelState.Expanded : UISplitPanelState.Collapsed;
+ EventHandler handler = Events[EventCollapseClick] as EventHandler;
+ handler?.Invoke(this, e);
+ }
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ base.OnPaint(e);
+
+ if (Panel1Collapsed || Panel2Collapsed)
+ {
+ return;
+ }
+
+ Rectangle rect = SplitterRectangle;
+ bool bHorizontal = Orientation == Orientation.Horizontal;
+
+ e.Graphics.FillRectangle(BarColor, rect);
+ if (_collapsePanel == UICollapsePanel.None)
+ {
+ return;
+ }
+
+ if (SplitterWidth < 11) SplitterWidth = 11;
+
+ Rectangle arrowRect = CalcArrowRect(CollapseRect);
+ Color handleRectColor = _uiControlState == UIControlState.Hover ? handleHoverColor : HandleColor;
+ Point[] points = GetHandlePoints();
+ using (Brush br = new SolidBrush(handleRectColor))
+ {
+ e.Graphics.SetHighQuality();
+ e.Graphics.FillPolygon(br, points);
+ e.Graphics.SetDefaultQuality();
+ }
+
+ switch (_collapsePanel)
+ {
+ case UICollapsePanel.Panel1:
+ if (bHorizontal)
+ {
+ e.Graphics.DrawFontImage(SplitPanelState == UISplitPanelState.Collapsed ? 61703 : 61702,
+ 22, arrowColor, arrowRect);
+ }
+ else
+ {
+ e.Graphics.DrawFontImage(SplitPanelState == UISplitPanelState.Collapsed ? 61701 : 61700,
+ 22, arrowColor, arrowRect);
+ }
+ break;
+ case UICollapsePanel.Panel2:
+ if (bHorizontal)
+ {
+ e.Graphics.DrawFontImage(SplitPanelState == UISplitPanelState.Collapsed ? 61702 : 61703,
+ 22, arrowColor, arrowRect);
+ }
+ else
+ {
+ e.Graphics.DrawFontImage(SplitPanelState == UISplitPanelState.Collapsed ? 61700 : 61701,
+ 22, arrowColor, arrowRect);
+ }
+ break;
+ }
+ }
+
+ protected Point[] GetHandlePoints()
+ {
+ bool bCollapsed = SplitPanelState == UISplitPanelState.Collapsed;
+
+ if (Orientation == Orientation.Horizontal)
+ {
+ if ((CollapsePanel == UICollapsePanel.Panel1 && !bCollapsed) ||
+ (CollapsePanel == UICollapsePanel.Panel2 && bCollapsed))
+ {
+ return new[]
+ {
+ new Point(CollapseRect.Left + 2, CollapseRect.Top),
+ new Point(CollapseRect.Right - 2, CollapseRect.Top),
+ new Point(CollapseRect.Right, CollapseRect.Bottom),
+ new Point(CollapseRect.Left, CollapseRect.Bottom),
+ new Point(CollapseRect.Left + 2, CollapseRect.Top)
+ };
+ }
+
+ if ((CollapsePanel == UICollapsePanel.Panel1 && bCollapsed) ||
+ (CollapsePanel == UICollapsePanel.Panel2 && !bCollapsed))
+ {
+ return new[]
+ {
+ new Point(CollapseRect.Left, CollapseRect.Top),
+ new Point(CollapseRect.Right, CollapseRect.Top),
+ new Point(CollapseRect.Right - 2, CollapseRect.Bottom),
+ new Point(CollapseRect.Left + 2, CollapseRect.Bottom),
+ new Point(CollapseRect.Left, CollapseRect.Top)
+ };
+ }
+ }
+
+ if (Orientation == Orientation.Vertical)
+ {
+ if ((CollapsePanel == UICollapsePanel.Panel1 && !bCollapsed) ||
+ (CollapsePanel == UICollapsePanel.Panel2 && bCollapsed))
+ {
+ return new[]
+ {
+ new Point(CollapseRect.Left, CollapseRect.Top + 2),
+ new Point(CollapseRect.Right, CollapseRect.Top),
+ new Point(CollapseRect.Right, CollapseRect.Bottom),
+ new Point(CollapseRect.Left, CollapseRect.Bottom - 2),
+ new Point(CollapseRect.Left, CollapseRect.Top + 2)
+ };
+ }
+
+ if ((CollapsePanel == UICollapsePanel.Panel1 && bCollapsed) ||
+ (CollapsePanel == UICollapsePanel.Panel2 && !bCollapsed))
+ {
+ return new[]
+ {
+ new Point(CollapseRect.Left,CollapseRect.Top),
+ new Point(CollapseRect.Right,CollapseRect.Top+2),
+ new Point(CollapseRect.Right,CollapseRect.Bottom-2),
+ new Point(CollapseRect.Left,CollapseRect.Bottom),
+ new Point(CollapseRect.Left,CollapseRect.Top)
+ };
+ }
+ }
+
+ return new Point[0];
+ }
+
+ protected override void OnMouseMove(MouseEventArgs e)
+ {
+ //如果鼠标的左键没有按下,重置鼠标状态
+ if (e.Button != MouseButtons.Left)
+ {
+ _uiMouseType = UIMouseType.None;
+ }
+
+ Rectangle collapseRect = CollapseRect;
+ Point mousePoint = e.Location;
+
+ //鼠标在Button矩形里,并且不是在拖动
+ if (collapseRect.Contains(mousePoint) && _uiMouseType != UIMouseType.Split)
+ {
+ Capture = false;
+ SetCursor(Cursors.Hand);
+ ControlState = UIControlState.Hover;
+ return;
+ }
+
+ //鼠标在分隔栏矩形里
+ if (SplitterRectangle.Contains(mousePoint))
+ {
+ ControlState = UIControlState.Normal;
+
+ //如果已经在按钮按下了鼠标或者已经收缩,就不允许拖动了
+ if (_uiMouseType == UIMouseType.Button ||
+ (_collapsePanel != UICollapsePanel.None && SplitPanelState == UISplitPanelState.Collapsed))
+ {
+ Capture = false;
+ base.Cursor = Cursors.Default;
+ return;
+ }
+
+ //鼠标没有按下,设置Split光标
+ if (_uiMouseType == UIMouseType.None && !IsSplitterFixed)
+ {
+ SetCursor(Orientation == Orientation.Horizontal ? Cursors.HSplit : Cursors.VSplit);
+ return;
+ }
+ }
+
+ ControlState = UIControlState.Normal;
+
+ //正在拖动分隔栏
+ if (_uiMouseType == UIMouseType.Split && !IsSplitterFixed)
+ {
+ SetCursor(Orientation == Orientation.Horizontal ? Cursors.HSplit : Cursors.VSplit);
+ base.OnMouseMove(e);
+ return;
+ }
+
+ base.Cursor = Cursors.Default;
+ base.OnMouseMove(e);
+ }
+
+ protected override void OnMouseLeave(EventArgs e)
+ {
+ base.Cursor = Cursors.Default;
+ ControlState = UIControlState.Normal;
+ base.OnMouseLeave(e);
+ }
+
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ Rectangle collapseRect = CollapseRect;
+ Point mousePoint = e.Location;
+
+ if (collapseRect.Contains(mousePoint) ||
+ (_collapsePanel != UICollapsePanel.None &&
+ SplitPanelState == UISplitPanelState.Collapsed))
+ {
+ _uiMouseType = UIMouseType.Button;
+ return;
+ }
+
+ if (SplitterRectangle.Contains(mousePoint))
+ {
+ _uiMouseType = UIMouseType.Split;
+ }
+
+ base.OnMouseDown(e);
+ }
+
+ protected override void OnKeyUp(KeyEventArgs e)
+ {
+ base.OnKeyUp(e);
+ Invalidate(SplitterRectangle);
+ }
+
+ protected override void OnMouseUp(MouseEventArgs e)
+ {
+ base.OnMouseUp(e);
+ Invalidate(SplitterRectangle);
+
+ Rectangle collapseRect = CollapseRect;
+ Point mousePoint = e.Location;
+
+ if (_uiMouseType == UIMouseType.Button && e.Button == MouseButtons.Left && collapseRect.Contains(mousePoint))
+ {
+ OnCollapseClick(EventArgs.Empty);
+ }
+
+ _uiMouseType = UIMouseType.None;
+ }
+
+ private void SetCursor(Cursor cursor)
+ {
+ if (base.Cursor != cursor)
+ {
+ base.Cursor = cursor;
+ }
+ }
+
+ private Rectangle CalcArrowRect(Rectangle collapseRect)
+ {
+ if (Orientation == Orientation.Horizontal)
+ {
+ int width = (collapseRect.Width - DefaultArrowWidth) / 2;
+ return new Rectangle(
+ collapseRect.X + width,
+ collapseRect.Y - 1,
+ DefaultArrowWidth,
+ collapseRect.Height);
+ }
+ else
+ {
+ int width = (collapseRect.Height - DefaultArrowWidth) / 2;
+ return new Rectangle(
+ collapseRect.X - 1,
+ collapseRect.Y + width,
+ collapseRect.Width,
+ DefaultArrowWidth);
+ }
+ }
+ }
+}