+ UIComboTreeView:新增下拉框TreeView

This commit is contained in:
Sunny 2020-11-11 23:15:21 +08:00
parent e2f5c4d2df
commit 6f8fbfc0db
9 changed files with 738 additions and 7 deletions

Binary file not shown.

Binary file not shown.

View File

@ -28,6 +28,54 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.TreeNode treeNode29 = new System.Windows.Forms.TreeNode("节点0");
System.Windows.Forms.TreeNode treeNode30 = new System.Windows.Forms.TreeNode("节点1");
System.Windows.Forms.TreeNode treeNode31 = new System.Windows.Forms.TreeNode("节点2");
System.Windows.Forms.TreeNode treeNode32 = new System.Windows.Forms.TreeNode("节点3");
System.Windows.Forms.TreeNode treeNode25 = new System.Windows.Forms.TreeNode("节点0");
System.Windows.Forms.TreeNode treeNode26 = new System.Windows.Forms.TreeNode("节点1");
System.Windows.Forms.TreeNode treeNode27 = new System.Windows.Forms.TreeNode("节点2");
System.Windows.Forms.TreeNode treeNode28 = new System.Windows.Forms.TreeNode("节点3");
System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("节点0");
System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("节点1");
System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("节点2");
System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("节点3");
System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("节点0", new System.Windows.Forms.TreeNode[] {
treeNode1,
treeNode2,
treeNode3,
treeNode4});
System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("节点4");
System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("节点5");
System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("节点6");
System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("节点7");
System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("节点1", new System.Windows.Forms.TreeNode[] {
treeNode6,
treeNode7,
treeNode8,
treeNode9});
System.Windows.Forms.TreeNode treeNode11 = new System.Windows.Forms.TreeNode("节点2");
System.Windows.Forms.TreeNode treeNode12 = new System.Windows.Forms.TreeNode("节点3");
System.Windows.Forms.TreeNode treeNode13 = new System.Windows.Forms.TreeNode("节点0");
System.Windows.Forms.TreeNode treeNode14 = new System.Windows.Forms.TreeNode("节点1");
System.Windows.Forms.TreeNode treeNode15 = new System.Windows.Forms.TreeNode("节点2");
System.Windows.Forms.TreeNode treeNode16 = new System.Windows.Forms.TreeNode("节点3");
System.Windows.Forms.TreeNode treeNode17 = new System.Windows.Forms.TreeNode("节点0", new System.Windows.Forms.TreeNode[] {
treeNode13,
treeNode14,
treeNode15,
treeNode16});
System.Windows.Forms.TreeNode treeNode18 = new System.Windows.Forms.TreeNode("节点4");
System.Windows.Forms.TreeNode treeNode19 = new System.Windows.Forms.TreeNode("节点5");
System.Windows.Forms.TreeNode treeNode20 = new System.Windows.Forms.TreeNode("节点6");
System.Windows.Forms.TreeNode treeNode21 = new System.Windows.Forms.TreeNode("节点7");
System.Windows.Forms.TreeNode treeNode22 = new System.Windows.Forms.TreeNode("节点1", new System.Windows.Forms.TreeNode[] {
treeNode18,
treeNode19,
treeNode20,
treeNode21});
System.Windows.Forms.TreeNode treeNode23 = new System.Windows.Forms.TreeNode("节点2");
System.Windows.Forms.TreeNode treeNode24 = new System.Windows.Forms.TreeNode("节点3");
this.uiLine8 = new Sunny.UI.UILine();
this.uiDatetimePicker1 = new Sunny.UI.UIDatetimePicker();
this.uiColorPicker1 = new Sunny.UI.UIColorPicker();
@ -39,11 +87,21 @@
this.uiDatePicker1 = new Sunny.UI.UIDatePicker();
this.uiComboBox2 = new Sunny.UI.UIComboBox();
this.uiComboBox1 = new Sunny.UI.UIComboBox();
this.uiComboTreeView1 = new Sunny.UI.UIComboTreeView();
this.uiLine1 = new Sunny.UI.UILine();
this.uiComboTreeView2 = new Sunny.UI.UIComboTreeView();
this.uiComboTreeView3 = new Sunny.UI.UIComboTreeView();
this.uiComboTreeView4 = new Sunny.UI.UIComboTreeView();
this.PagePanel.SuspendLayout();
this.SuspendLayout();
//
// PagePanel
//
this.PagePanel.Controls.Add(this.uiComboTreeView3);
this.PagePanel.Controls.Add(this.uiComboTreeView4);
this.PagePanel.Controls.Add(this.uiComboTreeView2);
this.PagePanel.Controls.Add(this.uiLine1);
this.PagePanel.Controls.Add(this.uiComboTreeView1);
this.PagePanel.Controls.Add(this.uiLine8);
this.PagePanel.Controls.Add(this.uiDatetimePicker1);
this.PagePanel.Controls.Add(this.uiColorPicker1);
@ -76,7 +134,7 @@
this.uiDatetimePicker1.MaxLength = 19;
this.uiDatetimePicker1.MinimumSize = new System.Drawing.Size(63, 0);
this.uiDatetimePicker1.Name = "uiDatetimePicker1";
this.uiDatetimePicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0);
this.uiDatetimePicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.uiDatetimePicker1.Size = new System.Drawing.Size(306, 29);
this.uiDatetimePicker1.SymbolDropDown = 61555;
this.uiDatetimePicker1.SymbolNormal = 61555;
@ -95,11 +153,12 @@
this.uiColorPicker1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiColorPicker1.MinimumSize = new System.Drawing.Size(63, 0);
this.uiColorPicker1.Name = "uiColorPicker1";
this.uiColorPicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0);
this.uiColorPicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.uiColorPicker1.Size = new System.Drawing.Size(150, 29);
this.uiColorPicker1.TabIndex = 40;
this.uiColorPicker1.Text = "uiColorPicker1";
this.uiColorPicker1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.uiColorPicker1.Value = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
//
// uiLine7
//
@ -132,7 +191,7 @@
this.uiTimePicker1.MaxLength = 8;
this.uiTimePicker1.MinimumSize = new System.Drawing.Size(63, 0);
this.uiTimePicker1.Name = "uiTimePicker1";
this.uiTimePicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0);
this.uiTimePicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.uiTimePicker1.Size = new System.Drawing.Size(150, 29);
this.uiTimePicker1.SymbolDropDown = 61555;
this.uiTimePicker1.SymbolNormal = 61555;
@ -173,7 +232,7 @@
this.uiDatePicker1.MaxLength = 10;
this.uiDatePicker1.MinimumSize = new System.Drawing.Size(63, 0);
this.uiDatePicker1.Name = "uiDatePicker1";
this.uiDatePicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0);
this.uiDatePicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.uiDatePicker1.Size = new System.Drawing.Size(150, 29);
this.uiDatePicker1.SymbolDropDown = 61555;
this.uiDatePicker1.SymbolNormal = 61555;
@ -199,7 +258,7 @@
this.uiComboBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiComboBox2.MinimumSize = new System.Drawing.Size(63, 0);
this.uiComboBox2.Name = "uiComboBox2";
this.uiComboBox2.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0);
this.uiComboBox2.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.uiComboBox2.Size = new System.Drawing.Size(150, 29);
this.uiComboBox2.TabIndex = 33;
this.uiComboBox2.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
@ -219,13 +278,168 @@
this.uiComboBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiComboBox1.MinimumSize = new System.Drawing.Size(63, 0);
this.uiComboBox1.Name = "uiComboBox1";
this.uiComboBox1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0);
this.uiComboBox1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.uiComboBox1.Size = new System.Drawing.Size(150, 29);
this.uiComboBox1.TabIndex = 32;
this.uiComboBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.uiComboBox1.Watermark = "水印文字";
this.uiComboBox1.DropDown += new System.EventHandler(this.uiComboBox1_DropDown);
//
// uiComboTreeView1
//
this.uiComboTreeView1.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList;
this.uiComboTreeView1.FillColor = System.Drawing.Color.White;
this.uiComboTreeView1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiComboTreeView1.Location = new System.Drawing.Point(30, 215);
this.uiComboTreeView1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiComboTreeView1.MinimumSize = new System.Drawing.Size(63, 0);
this.uiComboTreeView1.Name = "uiComboTreeView1";
treeNode29.Name = "节点0";
treeNode29.Text = "节点0";
treeNode30.Name = "节点1";
treeNode30.Text = "节点1";
treeNode31.Name = "节点2";
treeNode31.Text = "节点2";
treeNode32.Name = "节点3";
treeNode32.Text = "节点3";
this.uiComboTreeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
treeNode29,
treeNode30,
treeNode31,
treeNode32});
this.uiComboTreeView1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.uiComboTreeView1.Size = new System.Drawing.Size(150, 29);
this.uiComboTreeView1.TabIndex = 43;
this.uiComboTreeView1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiLine1
//
this.uiLine1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLine1.Location = new System.Drawing.Point(30, 181);
this.uiLine1.MinimumSize = new System.Drawing.Size(16, 16);
this.uiLine1.Name = "uiLine1";
this.uiLine1.Size = new System.Drawing.Size(664, 20);
this.uiLine1.TabIndex = 45;
this.uiLine1.Text = "UIComboTreeView";
this.uiLine1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiComboTreeView2
//
this.uiComboTreeView2.CheckBoxes = true;
this.uiComboTreeView2.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList;
this.uiComboTreeView2.FillColor = System.Drawing.Color.White;
this.uiComboTreeView2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiComboTreeView2.Location = new System.Drawing.Point(188, 215);
this.uiComboTreeView2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiComboTreeView2.MinimumSize = new System.Drawing.Size(63, 0);
this.uiComboTreeView2.Name = "uiComboTreeView2";
treeNode25.Name = "节点0";
treeNode25.Text = "节点0";
treeNode26.Name = "节点1";
treeNode26.Text = "节点1";
treeNode27.Name = "节点2";
treeNode27.Text = "节点2";
treeNode28.Name = "节点3";
treeNode28.Text = "节点3";
this.uiComboTreeView2.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
treeNode25,
treeNode26,
treeNode27,
treeNode28});
this.uiComboTreeView2.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.uiComboTreeView2.Size = new System.Drawing.Size(150, 29);
this.uiComboTreeView2.TabIndex = 46;
this.uiComboTreeView2.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiComboTreeView3
//
this.uiComboTreeView3.CheckBoxes = true;
this.uiComboTreeView3.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList;
this.uiComboTreeView3.FillColor = System.Drawing.Color.White;
this.uiComboTreeView3.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiComboTreeView3.Location = new System.Drawing.Point(546, 215);
this.uiComboTreeView3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiComboTreeView3.MinimumSize = new System.Drawing.Size(63, 0);
this.uiComboTreeView3.Name = "uiComboTreeView3";
treeNode1.Name = "节点0";
treeNode1.Text = "节点0";
treeNode2.Name = "节点1";
treeNode2.Text = "节点1";
treeNode3.Name = "节点2";
treeNode3.Text = "节点2";
treeNode4.Name = "节点3";
treeNode4.Text = "节点3";
treeNode5.Name = "节点0";
treeNode5.Text = "节点0";
treeNode6.Name = "节点4";
treeNode6.Text = "节点4";
treeNode7.Name = "节点5";
treeNode7.Text = "节点5";
treeNode8.Name = "节点6";
treeNode8.Text = "节点6";
treeNode9.Name = "节点7";
treeNode9.Text = "节点7";
treeNode10.Name = "节点1";
treeNode10.Text = "节点1";
treeNode11.Name = "节点2";
treeNode11.Text = "节点2";
treeNode12.Name = "节点3";
treeNode12.Text = "节点3";
this.uiComboTreeView3.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
treeNode5,
treeNode10,
treeNode11,
treeNode12});
this.uiComboTreeView3.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.uiComboTreeView3.ShowLines = true;
this.uiComboTreeView3.Size = new System.Drawing.Size(150, 29);
this.uiComboTreeView3.TabIndex = 48;
this.uiComboTreeView3.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiComboTreeView4
//
this.uiComboTreeView4.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList;
this.uiComboTreeView4.FillColor = System.Drawing.Color.White;
this.uiComboTreeView4.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiComboTreeView4.Location = new System.Drawing.Point(388, 215);
this.uiComboTreeView4.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiComboTreeView4.MinimumSize = new System.Drawing.Size(63, 0);
this.uiComboTreeView4.Name = "uiComboTreeView4";
treeNode13.Name = "节点0";
treeNode13.Text = "节点0";
treeNode14.Name = "节点1";
treeNode14.Text = "节点1";
treeNode15.Name = "节点2";
treeNode15.Text = "节点2";
treeNode16.Name = "节点3";
treeNode16.Text = "节点3";
treeNode17.Name = "节点0";
treeNode17.Text = "节点0";
treeNode18.Name = "节点4";
treeNode18.Text = "节点4";
treeNode19.Name = "节点5";
treeNode19.Text = "节点5";
treeNode20.Name = "节点6";
treeNode20.Text = "节点6";
treeNode21.Name = "节点7";
treeNode21.Text = "节点7";
treeNode22.Name = "节点1";
treeNode22.Text = "节点1";
treeNode23.Name = "节点2";
treeNode23.Text = "节点2";
treeNode24.Name = "节点3";
treeNode24.Text = "节点3";
this.uiComboTreeView4.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
treeNode17,
treeNode22,
treeNode23,
treeNode24});
this.uiComboTreeView4.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.uiComboTreeView4.ShowLines = true;
this.uiComboTreeView4.Size = new System.Drawing.Size(150, 29);
this.uiComboTreeView4.TabIndex = 47;
this.uiComboTreeView4.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
//
// FCombobox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
@ -252,5 +466,10 @@
private UIDatePicker uiDatePicker1;
private UIComboBox uiComboBox2;
private UIComboBox uiComboBox1;
private UIComboTreeView uiComboTreeView2;
private UILine uiLine1;
private UIComboTreeView uiComboTreeView1;
private UIComboTreeView uiComboTreeView3;
private UIComboTreeView uiComboTreeView4;
}
}

View File

@ -0,0 +1,148 @@
using System.ComponentModel;
namespace Sunny.UI
{
public class UIComboTreeViewItem : UIDropDownItem
{
private UIPanel panel;
private UISymbolButton btnCancel;
private UISymbolButton btnOK;
private UITreeView treeView;
public UITreeView TreeView => treeView;
[DefaultValue(false)]
public bool CheckBoxes
{
get => treeView.CheckBoxes;
set
{
treeView.CheckBoxes = value;
panel.Visible = CheckBoxes;
}
}
public UIComboTreeViewItem()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.treeView = new Sunny.UI.UITreeView();
this.panel = new Sunny.UI.UIPanel();
this.btnCancel = new Sunny.UI.UISymbolButton();
this.btnOK = new Sunny.UI.UISymbolButton();
this.panel.SuspendLayout();
this.SuspendLayout();
//
// treeView
//
this.treeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeView.FillColor = System.Drawing.Color.White;
this.treeView.Font = new System.Drawing.Font("微软雅黑", 12F);
this.treeView.Location = new System.Drawing.Point(0, 0);
this.treeView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.treeView.MinimumSize = new System.Drawing.Size(1, 1);
this.treeView.Name = "treeView";
this.treeView.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.treeView.SelectedNode = null;
this.treeView.Size = new System.Drawing.Size(250, 176);
this.treeView.TabIndex = 0;
this.treeView.Text = "uiTreeView1";
this.treeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.TreeView_NodeMouseClick);
//
// panel
//
this.panel.Controls.Add(this.btnCancel);
this.panel.Controls.Add(this.btnOK);
this.panel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel.Font = new System.Drawing.Font("微软雅黑", 12F);
this.panel.Location = new System.Drawing.Point(0, 176);
this.panel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.panel.MinimumSize = new System.Drawing.Size(1, 1);
this.panel.Name = "panel";
this.panel.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.panel.RectSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)(((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
| System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
this.panel.Size = new System.Drawing.Size(250, 44);
this.panel.TabIndex = 1;
this.panel.Text = null;
this.panel.Visible = false;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCancel.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.btnCancel.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(127)))), ((int)(((byte)(128)))));
this.btnCancel.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
this.btnCancel.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Location = new System.Drawing.Point(159, 8);
this.btnCancel.MinimumSize = new System.Drawing.Size(1, 1);
this.btnCancel.Name = "btnCancel";
this.btnCancel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.btnCancel.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(127)))), ((int)(((byte)(128)))));
this.btnCancel.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
this.btnCancel.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89)))));
this.btnCancel.Size = new System.Drawing.Size(80, 29);
this.btnCancel.Style = Sunny.UI.UIStyle.Red;
this.btnCancel.StyleCustomMode = true;
this.btnCancel.Symbol = 61453;
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnOK
//
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnOK.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOK.Location = new System.Drawing.Point(70, 8);
this.btnOK.MinimumSize = new System.Drawing.Size(1, 1);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(80, 29);
this.btnOK.TabIndex = 0;
this.btnOK.Text = "确定";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// UIComboTreeViewItem
//
this.Controls.Add(this.treeView);
this.Controls.Add(this.panel);
this.Name = "UIComboTreeViewItem";
this.Size = new System.Drawing.Size(250, 220);
this.panel.ResumeLayout(false);
this.ResumeLayout(false);
}
private void TreeView_NodeMouseClick(object sender, System.Windows.Forms.TreeNodeMouseClickEventArgs e)
{
if (!treeView.CheckBoxes && e.Node.Nodes.Count == 0)
{
DoValueChanged(this, e.Node);
CloseParent();
}
}
public override void SetStyle(UIBaseStyle style)
{
treeView.Style = style.Name;
panel.Style = style.Name;
btnOK.Style = style.Name;
}
private void btnCancel_Click(object sender, System.EventArgs e)
{
CloseParent();
}
private void btnOK_Click(object sender, System.EventArgs e)
{
DoValueChanged(this, treeView.Nodes);
CloseParent();
}
}
}

View File

@ -0,0 +1,120 @@
<?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>
</root>

View File

@ -65,6 +65,12 @@ namespace Sunny.UI
TextAlignment = ContentAlignment.MiddleLeft;
fillColor = Color.White;
edit.BackColor = Color.White;
PaintOther += UIDropControl_PaintOther;
}
private void UIDropControl_PaintOther(object sender, PaintEventArgs e)
{
e.Graphics.DrawLine(RectColor, Width - 1, Radius, Width - 1, Height - Radius);
}
private void Edit_LostFocus(object sender, EventArgs e)
@ -256,13 +262,15 @@ namespace Sunny.UI
if (!edit.Visible)
{
base.OnPaintFore(g, path);
g.FillRoundRectangle(GetFillColor(), new Rectangle(Width - 27, edit.Top, 26, edit.Height), Radius, false);
g.DrawRoundRectangle(rectColor, new Rectangle(0, 0, Width, Height), Radius, true);
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Padding = new Padding(0, 0, 30, 0);
Padding = new Padding(0, 0, 30, 2);
e.Graphics.FillRoundRectangle(GetFillColor(), new Rectangle(Width - 27, edit.Top, 25, edit.Height), Radius);
Color color = GetRectColor();
SizeF sf = e.Graphics.GetFontImageSize(dropSymbol, 24);
@ -307,6 +315,7 @@ namespace Sunny.UI
set => edit.Text = value;
}
[Browsable(false)]
public bool IsEmpty => edit.Text == "";
protected override void OnMouseDown(MouseEventArgs e)

View File

@ -0,0 +1,103 @@
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace Sunny.UI
{
[ToolboxItem(true)]
public class UIComboTreeView : UIDropControl
{
public UIComboTreeView()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.SuspendLayout();
//
// UIComboTreeView
//
this.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList;
this.Name = "UIComboTreeView";
this.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0);
this.ButtonClick += new System.EventHandler(this.UIComboTreeView_ButtonClick);
this.ResumeLayout(false);
this.PerformLayout();
}
[Browsable(false)]
public UITreeView TreeView => item.TreeView;
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[Localizable(true)]
[MergableProperty(false)]
[Description("显示节点集合"), Category("SunnyUI")]
public TreeNodeCollection Nodes => item.TreeView.Nodes;
[DefaultValue(false), Description("是否显示单选框"), Category("SunnyUI")]
public bool CheckBoxes
{
get => item.CheckBoxes;
set => item.CheckBoxes = value;
}
[DefaultValue(false), Description("是否显示连线"), Category("SunnyUI")]
public bool ShowLines
{
get => item.TreeView.ShowLines;
set => item.TreeView.ShowLines = value;
}
private readonly UIComboTreeViewItem item = new UIComboTreeViewItem();
protected override void CreateInstance()
{
ItemForm = new UIDropDown(item);
}
[Browsable(false), DefaultValue(null)]
public TreeNode SelectedNode
{
get => item.TreeView.SelectedNode;
set
{
item.TreeView.SelectedNode = value;
Text = value.Text;
}
}
public delegate void OnNodeSelected(object sender, TreeNode node);
public delegate void OnNodesSelected(object sender, TreeNodeCollection node);
public event OnNodeSelected NodeSelected;
public event OnNodesSelected NodesSelected;
protected override void ItemForm_ValueChanged(object sender, object value)
{
if (!CheckBoxes)
{
TreeNode node = (TreeNode)value;
Text = node.Text;
NodeSelected?.Invoke(this, node);
}
else
{
NodesSelected?.Invoke(this, Nodes);
}
Invalidate();
}
private void UIComboTreeView_ButtonClick(object sender, System.EventArgs e)
{
ItemForm.Size = ItemSize;
item.TreeView.ExpandAll();
ItemForm.Show(this);
}
[DefaultValue(typeof(Size), "250, 220"), Description("下拉弹框界面大小"), Category("SunnyUI")]
public Size ItemSize { get; set; } = new Size(250, 220);
}
}

View File

@ -0,0 +1,120 @@
<?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>
</root>

View File

@ -93,6 +93,9 @@
<Compile Include="Controls\DropItem\UIComboBoxItem.Designer.cs">
<DependentUpon>UIComboBoxItem.cs</DependentUpon>
</Compile>
<Compile Include="Controls\DropItem\UIComboTreeViewItem.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\DropItem\UIDateItem.cs">
<SubType>UserControl</SubType>
</Compile>
@ -117,6 +120,9 @@
<Compile Include="Controls\UIBattery.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\UIComboTreeView.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\UIDatetimePicker.cs">
<SubType>UserControl</SubType>
</Compile>
@ -534,6 +540,12 @@
<Compile Include="Win32\Win32.User.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Controls\DropItem\UIComboTreeViewItem.resx">
<DependentUpon>UIComboTreeViewItem.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\UIComboTreeView.resx">
<DependentUpon>UIComboTreeView.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\UIDoubleUpDown.resx">
<DependentUpon>UIDoubleUpDown.cs</DependentUpon>
</EmbeddedResource>