+ UISplitContainer: 增加UISplitContainer控件

This commit is contained in:
Sunny 2021-10-30 22:24:27 +08:00
parent 3c8772aea8
commit 30c369f0b6
8 changed files with 976 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@ -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();
}
}
}

View File

@ -0,0 +1,210 @@

namespace SunnyUI.VIP.Demo
{
partial class FSplitContainer
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
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;
}
}

View File

@ -0,0 +1,172 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="imageList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="imageList1.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAC+
CQAAAk1TRnQBSQFMAgEBBAEAARgBAAEYAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm
AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZk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MDAAHsAf8HuwP/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
</value>
</data>
</root>

View File

@ -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));

View File

@ -125,6 +125,12 @@
<Compile Include="Controls\FLine.Designer.cs">
<DependentUpon>FLine.cs</DependentUpon>
</Compile>
<Compile Include="Controls\FSplitContainer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Controls\FSplitContainer.designer.cs">
<DependentUpon>FSplitContainer.cs</DependentUpon>
</Compile>
<Compile Include="Industrial\FLight.cs">
<SubType>Form</SubType>
</Compile>
@ -401,6 +407,9 @@
<EmbeddedResource Include="Controls\FLine.resx">
<DependentUpon>FLine.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\FSplitContainer.resx">
<DependentUpon>FSplitContainer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Industrial\FLight.resx">
<DependentUpon>FLight.cs</DependentUpon>
</EmbeddedResource>

View File

@ -0,0 +1,532 @@
/******************************************************************************
* SunnyUI
* CopyRight (C) 2012-2021 ShenYongHua().
* QQ群56829229 QQ17612584 EMailSunnyUI@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
{
/// <summary>
/// 正常。
/// </summary>
Normal,
/// <summary>
/// 鼠标进入。
/// </summary>
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);
}
}
}
}