+ UIDatetimePicker:新增;* UITabControl:新增关闭按钮;* UINavBar:修改未设置PageIndex不相应按钮事件

This commit is contained in:
Sunny 2020-06-02 22:15:54 +08:00
parent 695f3706e8
commit 3c01ac77cb
23 changed files with 2063 additions and 1126 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -55,9 +55,7 @@
System.Windows.Forms.TreeNode treeNode57 = new System.Windows.Forms.TreeNode("节点2", new System.Windows.Forms.TreeNode[] {
treeNode55,
treeNode56});
System.Windows.Forms.TreeNode treeNode58 = new System.Windows.Forms.TreeNode("节点9");
System.Windows.Forms.TreeNode treeNode59 = new System.Windows.Forms.TreeNode("节点3", new System.Windows.Forms.TreeNode[] {
treeNode58});
System.Windows.Forms.TreeNode treeNode58 = new System.Windows.Forms.TreeNode("节点3");
System.Windows.Forms.TreeNode treeNode22 = new System.Windows.Forms.TreeNode("节点14");
System.Windows.Forms.TreeNode treeNode23 = new System.Windows.Forms.TreeNode("节点15");
System.Windows.Forms.TreeNode treeNode24 = new System.Windows.Forms.TreeNode("节点16");
@ -129,7 +127,7 @@
this.PagePanel.Controls.Add(this.uiNavMenu2);
this.PagePanel.Controls.Add(this.uiNavMenu1);
this.PagePanel.Controls.Add(this.uiNavBar1);
this.PagePanel.Size = new System.Drawing.Size(800, 545);
this.PagePanel.Size = new System.Drawing.Size(1107, 626);
//
// uiNavBar1
//
@ -138,6 +136,7 @@
this.uiNavBar1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiNavBar1.Location = new System.Drawing.Point(0, 0);
this.uiNavBar1.Name = "uiNavBar1";
this.uiNavBar1.NodeAlignment = System.Drawing.StringAlignment.Near;
treeNode43.Name = "节点0";
treeNode43.Text = "节点0";
treeNode44.Name = "节点1";
@ -168,18 +167,18 @@
treeNode56.Text = "节点8";
treeNode57.Name = "节点2";
treeNode57.Text = "节点2";
treeNode58.Name = "节点9";
treeNode58.Text = "节点9";
treeNode59.Name = "节点3";
treeNode59.Text = "节点3";
treeNode58.Name = "节点3";
treeNode58.Text = "节点3";
this.uiNavBar1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
treeNode50,
treeNode54,
treeNode57,
treeNode59});
this.uiNavBar1.Size = new System.Drawing.Size(800, 110);
treeNode58});
this.uiNavBar1.Size = new System.Drawing.Size(1107, 110);
this.uiNavBar1.TabIndex = 0;
this.uiNavBar1.Text = "uiNavBar1";
this.uiNavBar1.MenuItemClick += new Sunny.UI.UINavBar.OnMenuItemClick(this.uiNavBar1_MenuItemClick);
this.uiNavBar1.NodeMouseClick += new Sunny.UI.UINavBar.OnNodeMouseClick(this.uiNavBar1_NodeMouseClick);
//
// uiLine1
//
@ -264,6 +263,7 @@
treeNode42});
this.uiNavMenu1.Size = new System.Drawing.Size(253, 353);
this.uiNavMenu1.TabIndex = 1;
this.uiNavMenu1.MenuItemClick += new Sunny.UI.UINavMenu.OnMenuItemClick(this.uiNavMenu1_MenuItemClick);
//
// uiNavMenu2
//
@ -354,7 +354,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 580);
this.ClientSize = new System.Drawing.Size(1107, 661);
this.Name = "FNavigation";
this.Text = "NavBar";
this.PagePanel.ResumeLayout(false);

View File

@ -5,6 +5,23 @@
public FNavigation()
{
InitializeComponent();
uiNavBar1.SetNodeItem(uiNavBar1.Nodes[0].Nodes[0], new NavMenuItem(100));
uiNavBar1.SetNodeItem(uiNavBar1.Nodes[0].Nodes[1], new NavMenuItem(101));
}
private void uiNavBar1_MenuItemClick(string itemText, int menuIndex, int pageIndex)
{
UIMessageTip.ShowOk(itemText + ", " + menuIndex + ", " + pageIndex);
}
private void uiNavBar1_NodeMouseClick(System.Windows.Forms.TreeNode node, int menuIndex, int pageIndex)
{
//UIMessageTip.ShowOk(node.Text + ", " + menuIndex + ", " + pageIndex);
}
private void uiNavMenu1_MenuItemClick(System.Windows.Forms.TreeNode node, NavMenuItem item, int pageIndex)
{
UIMessageTip.ShowOk(node.Text + ", " + pageIndex);
}
}
}

View File

@ -31,9 +31,12 @@
this.uiTabControl1 = new Sunny.UI.UITabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.uiLine1 = new Sunny.UI.UILine();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.tabPage9 = new System.Windows.Forms.TabPage();
this.tabPage10 = new System.Windows.Forms.TabPage();
this.tabPage11 = new System.Windows.Forms.TabPage();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.uiLine1 = new Sunny.UI.UILine();
this.uiLine2 = new Sunny.UI.UILine();
this.uiTabControlMenu1 = new Sunny.UI.UITabControlMenu();
this.tabPage5 = new System.Windows.Forms.TabPage();
@ -58,16 +61,20 @@
this.uiTabControl1.Controls.Add(this.tabPage1);
this.uiTabControl1.Controls.Add(this.tabPage2);
this.uiTabControl1.Controls.Add(this.tabPage3);
this.uiTabControl1.Controls.Add(this.tabPage4);
this.uiTabControl1.Controls.Add(this.tabPage9);
this.uiTabControl1.Controls.Add(this.tabPage10);
this.uiTabControl1.Controls.Add(this.tabPage11);
this.uiTabControl1.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed;
this.uiTabControl1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiTabControl1.ItemSize = new System.Drawing.Size(150, 40);
this.uiTabControl1.Location = new System.Drawing.Point(30, 52);
this.uiTabControl1.Name = "uiTabControl1";
this.uiTabControl1.SelectedIndex = 0;
this.uiTabControl1.ShowActiveCloseButton = true;
this.uiTabControl1.Size = new System.Drawing.Size(670, 183);
this.uiTabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.uiTabControl1.TabIndex = 0;
this.uiTabControl1.BeforeRemoveTabPage += new Sunny.UI.UITabControl.OnBeforeRemoveTabPage(this.uiTabControl1_BeforeRemoveTabPage);
//
// tabPage1
//
@ -87,6 +94,51 @@
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "tabPage2";
//
// tabPage3
//
this.tabPage3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
this.tabPage3.Location = new System.Drawing.Point(0, 40);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(670, 143);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "tabPage3";
//
// tabPage9
//
this.tabPage9.Location = new System.Drawing.Point(0, 40);
this.tabPage9.Name = "tabPage9";
this.tabPage9.Size = new System.Drawing.Size(670, 143);
this.tabPage9.TabIndex = 4;
this.tabPage9.Text = "tabPage9";
this.tabPage9.UseVisualStyleBackColor = true;
//
// tabPage10
//
this.tabPage10.Location = new System.Drawing.Point(0, 40);
this.tabPage10.Name = "tabPage10";
this.tabPage10.Size = new System.Drawing.Size(670, 143);
this.tabPage10.TabIndex = 5;
this.tabPage10.Text = "tabPage10";
this.tabPage10.UseVisualStyleBackColor = true;
//
// tabPage11
//
this.tabPage11.Location = new System.Drawing.Point(0, 40);
this.tabPage11.Name = "tabPage11";
this.tabPage11.Size = new System.Drawing.Size(670, 143);
this.tabPage11.TabIndex = 6;
this.tabPage11.Text = "tabPage11";
this.tabPage11.UseVisualStyleBackColor = true;
//
// tabPage4
//
this.tabPage4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
this.tabPage4.Location = new System.Drawing.Point(0, 40);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(670, 143);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "tabPage4";
//
// uiLine1
//
this.uiLine1.Font = new System.Drawing.Font("微软雅黑", 12F);
@ -98,24 +150,6 @@
this.uiLine1.Text = "UITabControl";
this.uiLine1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// tabPage3
//
this.tabPage3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
this.tabPage3.Location = new System.Drawing.Point(0, 40);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(670, 143);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "tabPage3";
//
// tabPage4
//
this.tabPage4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
this.tabPage4.Location = new System.Drawing.Point(0, 40);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(670, 143);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "tabPage4";
//
// uiLine2
//
this.uiLine2.Font = new System.Drawing.Font("微软雅黑", 12F);
@ -210,5 +244,8 @@
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.TabPage tabPage7;
private System.Windows.Forms.TabPage tabPage8;
private System.Windows.Forms.TabPage tabPage9;
private System.Windows.Forms.TabPage tabPage10;
private System.Windows.Forms.TabPage tabPage11;
}
}

View File

@ -6,5 +6,10 @@
{
InitializeComponent();
}
private bool uiTabControl1_BeforeRemoveTabPage(object sender, int index)
{
return this.ShowAskDialog("Do you want to close the tab : " + uiTabControl1.TabPages[index].Text + "?");
}
}
}

View File

@ -48,11 +48,15 @@
this.uiLine6 = new Sunny.UI.UILine();
this.uiLine7 = new Sunny.UI.UILine();
this.uiColorPicker1 = new Sunny.UI.UIColorPicker();
this.uiDatetimePicker1 = new Sunny.UI.UIDatetimePicker();
this.uiLine8 = new Sunny.UI.UILine();
this.PagePanel.SuspendLayout();
this.SuspendLayout();
//
// PagePanel
//
this.PagePanel.Controls.Add(this.uiLine8);
this.PagePanel.Controls.Add(this.uiDatetimePicker1);
this.PagePanel.Controls.Add(this.uiColorPicker1);
this.PagePanel.Controls.Add(this.uiLine7);
this.PagePanel.Controls.Add(this.uiLine6);
@ -78,7 +82,7 @@
// uiIntegerUpDown1
//
this.uiIntegerUpDown1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiIntegerUpDown1.Location = new System.Drawing.Point(394, 212);
this.uiIntegerUpDown1.Location = new System.Drawing.Point(388, 54);
this.uiIntegerUpDown1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiIntegerUpDown1.Maximum = 100;
this.uiIntegerUpDown1.Minimum = -100;
@ -230,7 +234,7 @@
// uiDoubleUpDown1
//
this.uiDoubleUpDown1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiDoubleUpDown1.Location = new System.Drawing.Point(394, 294);
this.uiDoubleUpDown1.Location = new System.Drawing.Point(388, 132);
this.uiDoubleUpDown1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiDoubleUpDown1.MinimumSize = new System.Drawing.Size(100, 0);
this.uiDoubleUpDown1.Name = "uiDoubleUpDown1";
@ -245,7 +249,7 @@
this.uiLine1.Location = new System.Drawing.Point(30, 20);
this.uiLine1.MinimumSize = new System.Drawing.Size(16, 16);
this.uiLine1.Name = "uiLine1";
this.uiLine1.Size = new System.Drawing.Size(670, 20);
this.uiLine1.Size = new System.Drawing.Size(308, 20);
this.uiLine1.TabIndex = 20;
this.uiLine1.Text = "UITextBox";
this.uiLine1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@ -275,7 +279,7 @@
// uiLine4
//
this.uiLine4.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLine4.Location = new System.Drawing.Point(394, 178);
this.uiLine4.Location = new System.Drawing.Point(388, 20);
this.uiLine4.MinimumSize = new System.Drawing.Size(16, 16);
this.uiLine4.Name = "uiLine4";
this.uiLine4.Size = new System.Drawing.Size(306, 20);
@ -286,7 +290,7 @@
// uiLine5
//
this.uiLine5.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLine5.Location = new System.Drawing.Point(394, 260);
this.uiLine5.Location = new System.Drawing.Point(388, 97);
this.uiLine5.MinimumSize = new System.Drawing.Size(16, 16);
this.uiLine5.Name = "uiLine5";
this.uiLine5.Size = new System.Drawing.Size(306, 20);
@ -350,6 +354,32 @@
this.uiColorPicker1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.uiColorPicker1.Value = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(159)))), ((int)(((byte)(254)))));
//
// uiDatetimePicker1
//
this.uiDatetimePicker1.FillColor = System.Drawing.Color.White;
this.uiDatetimePicker1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiDatetimePicker1.Location = new System.Drawing.Point(388, 294);
this.uiDatetimePicker1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
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.Size = new System.Drawing.Size(306, 29);
this.uiDatetimePicker1.TabIndex = 30;
this.uiDatetimePicker1.Text = "uiDatetimePicker1";
this.uiDatetimePicker1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.uiDatetimePicker1.Value = new System.DateTime(2020, 6, 2, 17, 57, 28, 203);
//
// uiLine8
//
this.uiLine8.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLine8.Location = new System.Drawing.Point(388, 260);
this.uiLine8.MinimumSize = new System.Drawing.Size(16, 16);
this.uiLine8.Name = "uiLine8";
this.uiLine8.Size = new System.Drawing.Size(306, 20);
this.uiLine8.TabIndex = 31;
this.uiLine8.Text = "UIDatetimePicker";
this.uiLine8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// FTextBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
@ -385,5 +415,7 @@
private UILine uiLine6;
private UILine uiLine7;
private UIColorPicker uiColorPicker1;
private UILine uiLine8;
private UIDatetimePicker uiDatetimePicker1;
}
}

View File

@ -10,6 +10,7 @@ namespace Sunny.UI.Demo
uiDatePicker1.Value = DateTime.Today;
uiTimePicker1.Value = DateTime.Now;
uiDatetimePicker1.Value = DateTime.Now;
}
}
}

View File

@ -39,6 +39,7 @@ namespace Sunny.UI.Demo
Aside.CreateChildNode(parent, 61508, 24, AddPage(new FEditor(), ++pageIndex));
Aside.CreateChildNode(parent, 61674, 24, AddPage(new FFrames(), ++pageIndex));
Header.SetNodeSymbol(Header.Nodes[2], 61502);
var styles = UIStyles.PopularStyles();
foreach (UIStyle style in styles)
{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -20,13 +20,14 @@
******************************************************************************/
using System;
using System.Diagnostics.SymbolStore;
using System.Drawing;
namespace Sunny.UI
{
public sealed class UITimeItem : UIDropDownItem
{
#region InitializeComponent
private UILine uiLine1;
private UISymbolButton s1;
private UISymbolButton m1;
@ -45,11 +46,370 @@ namespace Sunny.UI
private UILabel sb;
private UILabel mb;
private UILabel hb;
private System.Windows.Forms.Timer timer1;
private System.ComponentModel.IContainer components;
private System.Windows.Forms.Timer timer2;
private UILine uiLine2;
private void InitializeComponent()
{
this.uiLine1 = new Sunny.UI.UILine();
this.uiLine2 = new Sunny.UI.UILine();
this.s1 = new Sunny.UI.UISymbolButton();
this.m1 = new Sunny.UI.UISymbolButton();
this.h1 = new Sunny.UI.UISymbolButton();
this.s2 = new Sunny.UI.UISymbolButton();
this.m2 = new Sunny.UI.UISymbolButton();
this.h2 = new Sunny.UI.UISymbolButton();
this.btnOK = new Sunny.UI.UISymbolButton();
this.btnCancel = new Sunny.UI.UISymbolButton();
this.hc = new Sunny.UI.UILabel();
this.mc = new Sunny.UI.UILabel();
this.sc = new Sunny.UI.UILabel();
this.st = new Sunny.UI.UILabel();
this.mt = new Sunny.UI.UILabel();
this.ht = new Sunny.UI.UILabel();
this.sb = new Sunny.UI.UILabel();
this.mb = new Sunny.UI.UILabel();
this.hb = new Sunny.UI.UILabel();
this.SuspendLayout();
//
// uiLine1
//
this.uiLine1.FillColor = System.Drawing.Color.White;
this.uiLine1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLine1.LineColor = System.Drawing.Color.Silver;
this.uiLine1.Location = new System.Drawing.Point(6, 54);
this.uiLine1.MinimumSize = new System.Drawing.Size(16, 16);
this.uiLine1.Name = "uiLine1";
this.uiLine1.Size = new System.Drawing.Size(157, 16);
this.uiLine1.Style = Sunny.UI.UIStyle.Custom;
this.uiLine1.StyleCustomMode = true;
this.uiLine1.TabIndex = 2;
//
// uiLine2
//
this.uiLine2.FillColor = System.Drawing.Color.White;
this.uiLine2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLine2.LineColor = System.Drawing.Color.Silver;
this.uiLine2.Location = new System.Drawing.Point(6, 88);
this.uiLine2.MinimumSize = new System.Drawing.Size(16, 16);
this.uiLine2.Name = "uiLine2";
this.uiLine2.Size = new System.Drawing.Size(157, 16);
this.uiLine2.Style = Sunny.UI.UIStyle.Custom;
this.uiLine2.StyleCustomMode = true;
this.uiLine2.TabIndex = 3;
//
// s1
//
this.s1.BackColor = System.Drawing.Color.Transparent;
this.s1.Cursor = System.Windows.Forms.Cursors.Hand;
this.s1.FillColor = System.Drawing.Color.White;
this.s1.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.s1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.s1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.s1.ImageInterval = 0;
this.s1.Location = new System.Drawing.Point(122, 4);
this.s1.Name = "s1";
this.s1.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0);
this.s1.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.s1.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.s1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.s1.Size = new System.Drawing.Size(30, 24);
this.s1.Style = Sunny.UI.UIStyle.Custom;
this.s1.StyleCustomMode = true;
this.s1.Symbol = 61702;
this.s1.TabIndex = 6;
this.s1.Tag = "3";
this.s1.Click += new System.EventHandler(this.s1_Click);
//
// m1
//
this.m1.BackColor = System.Drawing.Color.Transparent;
this.m1.Cursor = System.Windows.Forms.Cursors.Hand;
this.m1.FillColor = System.Drawing.Color.White;
this.m1.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.m1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.m1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.m1.ImageInterval = 0;
this.m1.Location = new System.Drawing.Point(69, 4);
this.m1.Name = "m1";
this.m1.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0);
this.m1.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.m1.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.m1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.m1.Size = new System.Drawing.Size(30, 24);
this.m1.Style = Sunny.UI.UIStyle.Custom;
this.m1.StyleCustomMode = true;
this.m1.Symbol = 61702;
this.m1.TabIndex = 5;
this.m1.Tag = "2";
this.m1.Click += new System.EventHandler(this.m1_Click);
//
// h1
//
this.h1.BackColor = System.Drawing.Color.Transparent;
this.h1.Cursor = System.Windows.Forms.Cursors.Hand;
this.h1.FillColor = System.Drawing.Color.White;
this.h1.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.h1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.h1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.h1.ImageInterval = 0;
this.h1.Location = new System.Drawing.Point(16, 4);
this.h1.Name = "h1";
this.h1.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0);
this.h1.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.h1.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.h1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.h1.Size = new System.Drawing.Size(30, 24);
this.h1.Style = Sunny.UI.UIStyle.Custom;
this.h1.StyleCustomMode = true;
this.h1.Symbol = 61702;
this.h1.TabIndex = 4;
this.h1.Tag = "1";
this.h1.Click += new System.EventHandler(this.h1_Click);
//
// s2
//
this.s2.BackColor = System.Drawing.Color.Transparent;
this.s2.Cursor = System.Windows.Forms.Cursors.Hand;
this.s2.FillColor = System.Drawing.Color.White;
this.s2.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.s2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.s2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.s2.ImageInterval = 0;
this.s2.Location = new System.Drawing.Point(122, 129);
this.s2.Name = "s2";
this.s2.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0);
this.s2.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.s2.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.s2.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.s2.Size = new System.Drawing.Size(30, 24);
this.s2.Style = Sunny.UI.UIStyle.Custom;
this.s2.StyleCustomMode = true;
this.s2.Symbol = 61703;
this.s2.TabIndex = 9;
this.s2.Tag = "6";
this.s2.Click += new System.EventHandler(this.s2_Click);
//
// m2
//
this.m2.BackColor = System.Drawing.Color.Transparent;
this.m2.Cursor = System.Windows.Forms.Cursors.Hand;
this.m2.FillColor = System.Drawing.Color.White;
this.m2.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.m2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.m2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.m2.ImageInterval = 0;
this.m2.Location = new System.Drawing.Point(69, 129);
this.m2.Name = "m2";
this.m2.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0);
this.m2.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.m2.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.m2.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.m2.Size = new System.Drawing.Size(30, 24);
this.m2.Style = Sunny.UI.UIStyle.Custom;
this.m2.StyleCustomMode = true;
this.m2.Symbol = 61703;
this.m2.TabIndex = 8;
this.m2.Tag = "5";
this.m2.Click += new System.EventHandler(this.m2_Click);
//
// h2
//
this.h2.BackColor = System.Drawing.Color.Transparent;
this.h2.Cursor = System.Windows.Forms.Cursors.Hand;
this.h2.FillColor = System.Drawing.Color.White;
this.h2.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.h2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.h2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.h2.ImageInterval = 0;
this.h2.Location = new System.Drawing.Point(16, 128);
this.h2.Name = "h2";
this.h2.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0);
this.h2.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.h2.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.h2.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.h2.Size = new System.Drawing.Size(30, 24);
this.h2.Style = Sunny.UI.UIStyle.Custom;
this.h2.StyleCustomMode = true;
this.h2.Symbol = 61703;
this.h2.TabIndex = 7;
this.h2.Tag = "4";
this.h2.Click += new System.EventHandler(this.h2_Click);
//
// btnOK
//
this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnOK.Font = new System.Drawing.Font("微软雅黑", 12F);
this.btnOK.Location = new System.Drawing.Point(8, 162);
this.btnOK.Name = "btnOK";
this.btnOK.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
this.btnOK.Size = new System.Drawing.Size(74, 27);
this.btnOK.Style = Sunny.UI.UIStyle.Custom;
this.btnOK.TabIndex = 10;
this.btnOK.Text = "确定";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F);
this.btnCancel.Location = new System.Drawing.Point(87, 162);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
this.btnCancel.Size = new System.Drawing.Size(74, 27);
this.btnCancel.Style = Sunny.UI.UIStyle.Custom;
this.btnCancel.Symbol = 61453;
this.btnCancel.TabIndex = 11;
this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// hc
//
this.hc.BackColor = System.Drawing.Color.Transparent;
this.hc.Font = new System.Drawing.Font("微软雅黑", 12F);
this.hc.Location = new System.Drawing.Point(9, 65);
this.hc.Name = "hc";
this.hc.Size = new System.Drawing.Size(46, 27);
this.hc.StyleCustomMode = true;
this.hc.TabIndex = 12;
this.hc.Text = "00";
this.hc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.hc.DoubleClick += new System.EventHandler(this.hc_DoubleClick);
//
// mc
//
this.mc.BackColor = System.Drawing.Color.Transparent;
this.mc.Font = new System.Drawing.Font("微软雅黑", 12F);
this.mc.Location = new System.Drawing.Point(62, 65);
this.mc.Name = "mc";
this.mc.Size = new System.Drawing.Size(46, 27);
this.mc.StyleCustomMode = true;
this.mc.TabIndex = 13;
this.mc.Text = "00";
this.mc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.mc.DoubleClick += new System.EventHandler(this.mc_DoubleClick);
//
// sc
//
this.sc.BackColor = System.Drawing.Color.Transparent;
this.sc.Font = new System.Drawing.Font("微软雅黑", 12F);
this.sc.Location = new System.Drawing.Point(115, 65);
this.sc.Name = "sc";
this.sc.Size = new System.Drawing.Size(46, 27);
this.sc.StyleCustomMode = true;
this.sc.TabIndex = 14;
this.sc.Text = "00";
this.sc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.sc.DoubleClick += new System.EventHandler(this.sc_DoubleClick);
//
// st
//
this.st.BackColor = System.Drawing.Color.Transparent;
this.st.Font = new System.Drawing.Font("微软雅黑", 12F);
this.st.ForeColor = System.Drawing.Color.DarkGray;
this.st.Location = new System.Drawing.Point(115, 31);
this.st.Name = "st";
this.st.Size = new System.Drawing.Size(46, 22);
this.st.StyleCustomMode = true;
this.st.TabIndex = 17;
this.st.Text = "00";
this.st.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// mt
//
this.mt.BackColor = System.Drawing.Color.Transparent;
this.mt.Font = new System.Drawing.Font("微软雅黑", 12F);
this.mt.ForeColor = System.Drawing.Color.DarkGray;
this.mt.Location = new System.Drawing.Point(62, 31);
this.mt.Name = "mt";
this.mt.Size = new System.Drawing.Size(46, 22);
this.mt.StyleCustomMode = true;
this.mt.TabIndex = 16;
this.mt.Text = "00";
this.mt.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// ht
//
this.ht.BackColor = System.Drawing.Color.Transparent;
this.ht.Font = new System.Drawing.Font("微软雅黑", 12F);
this.ht.ForeColor = System.Drawing.Color.DarkGray;
this.ht.Location = new System.Drawing.Point(9, 31);
this.ht.Name = "ht";
this.ht.Size = new System.Drawing.Size(46, 22);
this.ht.StyleCustomMode = true;
this.ht.TabIndex = 15;
this.ht.Text = "00";
this.ht.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// sb
//
this.sb.BackColor = System.Drawing.Color.Transparent;
this.sb.Font = new System.Drawing.Font("微软雅黑", 12F);
this.sb.ForeColor = System.Drawing.Color.DarkGray;
this.sb.Location = new System.Drawing.Point(115, 103);
this.sb.Name = "sb";
this.sb.Size = new System.Drawing.Size(46, 22);
this.sb.StyleCustomMode = true;
this.sb.TabIndex = 20;
this.sb.Text = "00";
this.sb.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// mb
//
this.mb.BackColor = System.Drawing.Color.Transparent;
this.mb.Font = new System.Drawing.Font("微软雅黑", 12F);
this.mb.ForeColor = System.Drawing.Color.DarkGray;
this.mb.Location = new System.Drawing.Point(62, 103);
this.mb.Name = "mb";
this.mb.Size = new System.Drawing.Size(46, 22);
this.mb.StyleCustomMode = true;
this.mb.TabIndex = 19;
this.mb.Text = "00";
this.mb.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// hb
//
this.hb.BackColor = System.Drawing.Color.Transparent;
this.hb.Font = new System.Drawing.Font("微软雅黑", 12F);
this.hb.ForeColor = System.Drawing.Color.DarkGray;
this.hb.Location = new System.Drawing.Point(9, 103);
this.hb.Name = "hb";
this.hb.Size = new System.Drawing.Size(46, 22);
this.hb.StyleCustomMode = true;
this.hb.TabIndex = 18;
this.hb.Text = "00";
this.hb.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// UITimeItem
//
this.Controls.Add(this.sb);
this.Controls.Add(this.mb);
this.Controls.Add(this.hb);
this.Controls.Add(this.st);
this.Controls.Add(this.mt);
this.Controls.Add(this.ht);
this.Controls.Add(this.sc);
this.Controls.Add(this.mc);
this.Controls.Add(this.hc);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.s2);
this.Controls.Add(this.m2);
this.Controls.Add(this.h2);
this.Controls.Add(this.s1);
this.Controls.Add(this.m1);
this.Controls.Add(this.h1);
this.Controls.Add(this.uiLine2);
this.Controls.Add(this.uiLine1);
this.FillColor = System.Drawing.Color.White;
this.Name = "UITimeItem";
this.Size = new System.Drawing.Size(168, 200);
this.Style = Sunny.UI.UIStyle.Custom;
this.ResumeLayout(false);
}
#endregion InitializeComponent
public UITimeItem()
{
InitializeComponent();
@ -60,32 +420,32 @@ namespace Sunny.UI
{
if (e.Delta < 0)
{
if (new Rectangle(hc.Location, hc.Size).Contains(e.X, e.Y))
if (new Rectangle(ht.Left, ht.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
h1_Click(null, null);
h1.PerformClick();
}
else if (new Rectangle(mc.Location, mc.Size).Contains(e.X, e.Y))
else if (new Rectangle(mt.Left, mt.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
m1_Click(null, null);
m1.PerformClick();
}
else if (new Rectangle(sc.Location, sc.Size).Contains(e.X, e.Y))
else if (new Rectangle(st.Left, st.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
s1_Click(null, null);
s1.PerformClick();
}
}
else if (e.Delta > 0)
{
if (new Rectangle(hc.Location, hc.Size).Contains(e.X, e.Y))
if (new Rectangle(ht.Left, ht.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
h2_Click(null, null);
h2.PerformClick();
}
else if (new Rectangle(mc.Location, mc.Size).Contains(e.X, e.Y))
else if (new Rectangle(mt.Left, mt.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
m2_Click(null, null);
m2.PerformClick();
}
else if (new Rectangle(sc.Location, sc.Size).Contains(e.X, e.Y))
else if (new Rectangle(st.Left, st.Top, ht.Width, hb.Bottom - ht.Top).Contains(e.X, e.Y))
{
s2_Click(null, null);
s2.PerformClick();
}
}
}
@ -149,384 +509,6 @@ namespace Sunny.UI
sb.Text = (second + 1 + 60).Mod(60).ToString();
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.uiLine1 = new Sunny.UI.UILine();
this.uiLine2 = new Sunny.UI.UILine();
this.s1 = new Sunny.UI.UISymbolButton();
this.m1 = new Sunny.UI.UISymbolButton();
this.h1 = new Sunny.UI.UISymbolButton();
this.s2 = new Sunny.UI.UISymbolButton();
this.m2 = new Sunny.UI.UISymbolButton();
this.h2 = new Sunny.UI.UISymbolButton();
this.btnOK = new Sunny.UI.UISymbolButton();
this.btnCancel = new Sunny.UI.UISymbolButton();
this.hc = new Sunny.UI.UILabel();
this.mc = new Sunny.UI.UILabel();
this.sc = new Sunny.UI.UILabel();
this.st = new Sunny.UI.UILabel();
this.mt = new Sunny.UI.UILabel();
this.ht = new Sunny.UI.UILabel();
this.sb = new Sunny.UI.UILabel();
this.mb = new Sunny.UI.UILabel();
this.hb = new Sunny.UI.UILabel();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// uiLine1
//
this.uiLine1.FillColor = System.Drawing.Color.White;
this.uiLine1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLine1.LineColor = System.Drawing.Color.Silver;
this.uiLine1.Location = new System.Drawing.Point(11, 60);
this.uiLine1.MinimumSize = new System.Drawing.Size(16, 16);
this.uiLine1.Name = "uiLine1";
this.uiLine1.Size = new System.Drawing.Size(157, 16);
this.uiLine1.Style = Sunny.UI.UIStyle.Custom;
this.uiLine1.StyleCustomMode = true;
this.uiLine1.TabIndex = 2;
//
// uiLine2
//
this.uiLine2.FillColor = System.Drawing.Color.White;
this.uiLine2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLine2.LineColor = System.Drawing.Color.Silver;
this.uiLine2.Location = new System.Drawing.Point(11, 94);
this.uiLine2.MinimumSize = new System.Drawing.Size(16, 16);
this.uiLine2.Name = "uiLine2";
this.uiLine2.Size = new System.Drawing.Size(157, 16);
this.uiLine2.Style = Sunny.UI.UIStyle.Custom;
this.uiLine2.StyleCustomMode = true;
this.uiLine2.TabIndex = 3;
//
// s1
//
this.s1.BackColor = System.Drawing.Color.Transparent;
this.s1.Cursor = System.Windows.Forms.Cursors.Hand;
this.s1.FillColor = System.Drawing.Color.White;
this.s1.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.s1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.s1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.s1.ImageInterval = 0;
this.s1.Location = new System.Drawing.Point(127, 13);
this.s1.Name = "s1";
this.s1.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0);
this.s1.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.s1.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.s1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.s1.Size = new System.Drawing.Size(30, 24);
this.s1.Style = Sunny.UI.UIStyle.Custom;
this.s1.StyleCustomMode = true;
this.s1.Symbol = 61702;
this.s1.TabIndex = 6;
this.s1.Tag = "3";
this.s1.Click += new System.EventHandler(this.s1_Click);
this.s1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.h1_MouseDown);
this.s1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.h1_MouseUp);
//
// m1
//
this.m1.BackColor = System.Drawing.Color.Transparent;
this.m1.Cursor = System.Windows.Forms.Cursors.Hand;
this.m1.FillColor = System.Drawing.Color.White;
this.m1.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.m1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.m1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.m1.ImageInterval = 0;
this.m1.Location = new System.Drawing.Point(74, 13);
this.m1.Name = "m1";
this.m1.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0);
this.m1.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.m1.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.m1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.m1.Size = new System.Drawing.Size(30, 24);
this.m1.Style = Sunny.UI.UIStyle.Custom;
this.m1.StyleCustomMode = true;
this.m1.Symbol = 61702;
this.m1.TabIndex = 5;
this.m1.Tag = "2";
this.m1.Click += new System.EventHandler(this.m1_Click);
this.m1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.h1_MouseDown);
this.m1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.h1_MouseUp);
//
// h1
//
this.h1.BackColor = System.Drawing.Color.Transparent;
this.h1.Cursor = System.Windows.Forms.Cursors.Hand;
this.h1.FillColor = System.Drawing.Color.White;
this.h1.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.h1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.h1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.h1.ImageInterval = 0;
this.h1.Location = new System.Drawing.Point(21, 13);
this.h1.Name = "h1";
this.h1.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0);
this.h1.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.h1.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.h1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.h1.Size = new System.Drawing.Size(30, 24);
this.h1.Style = Sunny.UI.UIStyle.Custom;
this.h1.StyleCustomMode = true;
this.h1.Symbol = 61702;
this.h1.TabIndex = 4;
this.h1.Tag = "1";
this.h1.Click += new System.EventHandler(this.h1_Click);
this.h1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.h1_MouseDown);
this.h1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.h1_MouseUp);
//
// s2
//
this.s2.BackColor = System.Drawing.Color.Transparent;
this.s2.Cursor = System.Windows.Forms.Cursors.Hand;
this.s2.FillColor = System.Drawing.Color.White;
this.s2.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.s2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.s2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.s2.ImageInterval = 0;
this.s2.Location = new System.Drawing.Point(127, 132);
this.s2.Name = "s2";
this.s2.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0);
this.s2.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.s2.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.s2.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.s2.Size = new System.Drawing.Size(30, 24);
this.s2.Style = Sunny.UI.UIStyle.Custom;
this.s2.StyleCustomMode = true;
this.s2.Symbol = 61703;
this.s2.TabIndex = 9;
this.s2.Tag = "6";
this.s2.Click += new System.EventHandler(this.s2_Click);
this.s2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.h1_MouseDown);
this.s2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.h1_MouseUp);
//
// m2
//
this.m2.BackColor = System.Drawing.Color.Transparent;
this.m2.Cursor = System.Windows.Forms.Cursors.Hand;
this.m2.FillColor = System.Drawing.Color.White;
this.m2.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.m2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.m2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.m2.ImageInterval = 0;
this.m2.Location = new System.Drawing.Point(74, 132);
this.m2.Name = "m2";
this.m2.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0);
this.m2.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.m2.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.m2.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.m2.Size = new System.Drawing.Size(30, 24);
this.m2.Style = Sunny.UI.UIStyle.Custom;
this.m2.StyleCustomMode = true;
this.m2.Symbol = 61703;
this.m2.TabIndex = 8;
this.m2.Tag = "5";
this.m2.Click += new System.EventHandler(this.m2_Click);
this.m2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.h1_MouseDown);
this.m2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.h1_MouseUp);
//
// h2
//
this.h2.BackColor = System.Drawing.Color.Transparent;
this.h2.Cursor = System.Windows.Forms.Cursors.Hand;
this.h2.FillColor = System.Drawing.Color.White;
this.h2.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.h2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.h2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.h2.ImageInterval = 0;
this.h2.Location = new System.Drawing.Point(21, 131);
this.h2.Name = "h2";
this.h2.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0);
this.h2.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.h2.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.h2.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.h2.Size = new System.Drawing.Size(30, 24);
this.h2.Style = Sunny.UI.UIStyle.Custom;
this.h2.StyleCustomMode = true;
this.h2.Symbol = 61703;
this.h2.TabIndex = 7;
this.h2.Tag = "4";
this.h2.Click += new System.EventHandler(this.h2_Click);
this.h2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.h1_MouseDown);
this.h2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.h1_MouseUp);
//
// btnOK
//
this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnOK.Font = new System.Drawing.Font("微软雅黑", 12F);
this.btnOK.Location = new System.Drawing.Point(13, 166);
this.btnOK.Name = "btnOK";
this.btnOK.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
this.btnOK.Size = new System.Drawing.Size(74, 27);
this.btnOK.TabIndex = 10;
this.btnOK.Text = "确定";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F);
this.btnCancel.Location = new System.Drawing.Point(92, 166);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
this.btnCancel.Size = new System.Drawing.Size(74, 27);
this.btnCancel.Symbol = 61453;
this.btnCancel.TabIndex = 11;
this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// hc
//
this.hc.BackColor = System.Drawing.Color.Transparent;
this.hc.Font = new System.Drawing.Font("微软雅黑", 12F);
this.hc.Location = new System.Drawing.Point(20, 73);
this.hc.Name = "hc";
this.hc.Size = new System.Drawing.Size(35, 22);
this.hc.StyleCustomMode = true;
this.hc.TabIndex = 12;
this.hc.Text = "00";
this.hc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// mc
//
this.mc.BackColor = System.Drawing.Color.Transparent;
this.mc.Font = new System.Drawing.Font("微软雅黑", 12F);
this.mc.Location = new System.Drawing.Point(73, 73);
this.mc.Name = "mc";
this.mc.Size = new System.Drawing.Size(35, 22);
this.mc.StyleCustomMode = true;
this.mc.TabIndex = 13;
this.mc.Text = "00";
this.mc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// sc
//
this.sc.BackColor = System.Drawing.Color.Transparent;
this.sc.Font = new System.Drawing.Font("微软雅黑", 12F);
this.sc.Location = new System.Drawing.Point(126, 73);
this.sc.Name = "sc";
this.sc.Size = new System.Drawing.Size(35, 22);
this.sc.StyleCustomMode = true;
this.sc.TabIndex = 14;
this.sc.Text = "00";
this.sc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// st
//
this.st.BackColor = System.Drawing.Color.Transparent;
this.st.Font = new System.Drawing.Font("微软雅黑", 12F);
this.st.ForeColor = System.Drawing.Color.DarkGray;
this.st.Location = new System.Drawing.Point(126, 40);
this.st.Name = "st";
this.st.Size = new System.Drawing.Size(35, 22);
this.st.StyleCustomMode = true;
this.st.TabIndex = 17;
this.st.Text = "00";
this.st.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// mt
//
this.mt.BackColor = System.Drawing.Color.Transparent;
this.mt.Font = new System.Drawing.Font("微软雅黑", 12F);
this.mt.ForeColor = System.Drawing.Color.DarkGray;
this.mt.Location = new System.Drawing.Point(73, 40);
this.mt.Name = "mt";
this.mt.Size = new System.Drawing.Size(35, 22);
this.mt.StyleCustomMode = true;
this.mt.TabIndex = 16;
this.mt.Text = "00";
this.mt.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// ht
//
this.ht.BackColor = System.Drawing.Color.Transparent;
this.ht.Font = new System.Drawing.Font("微软雅黑", 12F);
this.ht.ForeColor = System.Drawing.Color.DarkGray;
this.ht.Location = new System.Drawing.Point(20, 40);
this.ht.Name = "ht";
this.ht.Size = new System.Drawing.Size(35, 22);
this.ht.StyleCustomMode = true;
this.ht.TabIndex = 15;
this.ht.Text = "00";
this.ht.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// sb
//
this.sb.BackColor = System.Drawing.Color.Transparent;
this.sb.Font = new System.Drawing.Font("微软雅黑", 12F);
this.sb.ForeColor = System.Drawing.Color.DarkGray;
this.sb.Location = new System.Drawing.Point(126, 106);
this.sb.Name = "sb";
this.sb.Size = new System.Drawing.Size(35, 22);
this.sb.StyleCustomMode = true;
this.sb.TabIndex = 20;
this.sb.Text = "00";
this.sb.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// mb
//
this.mb.BackColor = System.Drawing.Color.Transparent;
this.mb.Font = new System.Drawing.Font("微软雅黑", 12F);
this.mb.ForeColor = System.Drawing.Color.DarkGray;
this.mb.Location = new System.Drawing.Point(73, 106);
this.mb.Name = "mb";
this.mb.Size = new System.Drawing.Size(35, 22);
this.mb.StyleCustomMode = true;
this.mb.TabIndex = 19;
this.mb.Text = "00";
this.mb.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// hb
//
this.hb.BackColor = System.Drawing.Color.Transparent;
this.hb.Font = new System.Drawing.Font("微软雅黑", 12F);
this.hb.ForeColor = System.Drawing.Color.DarkGray;
this.hb.Location = new System.Drawing.Point(20, 106);
this.hb.Name = "hb";
this.hb.Size = new System.Drawing.Size(35, 22);
this.hb.StyleCustomMode = true;
this.hb.TabIndex = 18;
this.hb.Text = "00";
this.hb.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// timer1
//
this.timer1.Interval = 500;
this.timer1.Tick += new System.EventHandler(this.timer_Tick);
//
// timer2
//
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
//
// UITimeItem
//
this.Controls.Add(this.sb);
this.Controls.Add(this.mb);
this.Controls.Add(this.hb);
this.Controls.Add(this.st);
this.Controls.Add(this.mt);
this.Controls.Add(this.ht);
this.Controls.Add(this.sc);
this.Controls.Add(this.mc);
this.Controls.Add(this.hc);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.s2);
this.Controls.Add(this.m2);
this.Controls.Add(this.h2);
this.Controls.Add(this.s1);
this.Controls.Add(this.m1);
this.Controls.Add(this.h1);
this.Controls.Add(this.uiLine2);
this.Controls.Add(this.uiLine1);
this.FillColor = System.Drawing.Color.White;
this.Name = "UITimeItem";
this.Size = new System.Drawing.Size(179, 200);
this.Style = Sunny.UI.UIStyle.Custom;
this.ResumeLayout(false);
}
private void h1_Click(object sender, EventArgs e)
{
Hour = (Hour - 1 + 24).Mod(24);
@ -575,43 +557,6 @@ namespace Sunny.UI
CloseParent();
}
private int buttonIndex;
private bool isEnd;
private void timer2_Tick(object sender, EventArgs e)
{
switch (buttonIndex)
{
case 1: h1_Click(null, null); break;
case 2: m1_Click(null, null); break;
case 3: s1_Click(null, null); break;
case 4: h2_Click(null, null); break;
case 5: m2_Click(null, null); break;
case 6: s2_Click(null, null); break;
}
if (isEnd) timer2.Stop();
}
private void timer_Tick(object sender, EventArgs e)
{
timer1.Stop();
if (!isEnd) timer2.Start();
}
private void h1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
isEnd = false;
buttonIndex = ((UISymbolButton)sender).Tag.ToString().ToInt();
timer1.Start();
}
private void h1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
timer1.Stop();
isEnd = true;
}
public override void SetStyle(UIBaseStyle style)
{
base.SetStyle(style);
@ -627,5 +572,26 @@ namespace Sunny.UI
m1.ForeColor = m2.ForeColor = color;
s1.ForeColor = s2.ForeColor = color;
}
private void hc_DoubleClick(object sender, EventArgs e)
{
Hour = 0;
Minute = 0;
Second = 0;
ShowOther();
}
private void mc_DoubleClick(object sender, EventArgs e)
{
Minute = 0;
Second = 0;
ShowOther();
}
private void sc_DoubleClick(object sender, EventArgs e)
{
Second = 0;
ShowOther();
}
}
}

View File

@ -117,10 +117,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="timer2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>107, 17</value>
</metadata>
</root>

View File

@ -234,32 +234,32 @@ namespace Sunny.UI
noneCheckBox.Name = "noneCheckBox";
noneCheckBox.Margin = new Padding(3, 3, 3, 1);
noneCheckBox.Text = "无(&N)";
noneCheckBox.Height = 16;
noneCheckBox.Height = 20;
allCheckBox.Name = "allCheckBox";
allCheckBox.Margin = new Padding(3, 3, 3, 1);
allCheckBox.Text = "全部(&A)";
allCheckBox.Height = 16;
allCheckBox.Height = 20;
leftTopCheckBox.Margin = new Padding(20, 1, 3, 1);
leftTopCheckBox.Name = "leftTopCheckBox";
leftTopCheckBox.Text = "左上角(&LT)";
leftTopCheckBox.Height = 16;
leftTopCheckBox.Height = 20;
rightTopCheckBox.Margin = new Padding(20, 1, 3, 1);
rightTopCheckBox.Name = "rightTopCheckBox";
rightTopCheckBox.Text = "右上角(&RT)";
rightTopCheckBox.Height = 16;
rightTopCheckBox.Height = 20;
leftBottomCheckBox.Margin = new Padding(20, 1, 3, 1);
leftBottomCheckBox.Name = "leftBottomCheckBox";
leftBottomCheckBox.Text = "左下角(&LB)";
leftBottomCheckBox.Height = 16;
leftBottomCheckBox.Height = 20;
rightBottomCheckBox.Margin = new Padding(20, 1, 3, 1);
rightBottomCheckBox.Name = "rightBottomCheckBox";
rightBottomCheckBox.Text = "右下角(&RB)";
rightBottomCheckBox.Height = 16;
rightBottomCheckBox.Height = 20;
splitterLabel.BackColor = SystemColors.ControlDark;
splitterLabel.Name = "splitterLabel";

View File

@ -0,0 +1,79 @@
using System;
using System.ComponentModel;
using System.Windows.Forms;
namespace Sunny.UI
{
[ToolboxItem(true)]
public sealed partial class UIDatetimePicker : UIDropControl
{
private void InitializeComponent()
{
this.SuspendLayout();
//
// UIDateTimePicker
//
this.Name = "UIDatetimePicker";
this.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0);
this.ButtonClick += new System.EventHandler(this.UIDatetimePicker_ButtonClick);
this.ResumeLayout(false);
this.PerformLayout();
}
public UIDatetimePicker()
{
InitializeComponent();
Value = DateTime.Now;
}
public delegate void OnDateTimeChanged(object sender, DateTime value);
public event OnDateTimeChanged ValueChanged;
protected override void ItemForm_ValueChanged(object sender, object value)
{
Value = (DateTime)value;
Text = Value.ToString(dateFormat);
Invalidate();
ValueChanged?.Invoke(this, Value);
}
private readonly UIDateTimeItem item = new UIDateTimeItem();
protected override void CreateInstance()
{
ItemForm = new UIDropDown(item);
}
public DateTime Value
{
get => item.Date;
set
{
Text = value.ToString(dateFormat);
item.Date = value;
}
}
private void UIDatetimePicker_ButtonClick(object sender, EventArgs e)
{
item.Date = Value;
ItemForm.Show(this);
}
private string dateFormat = "yyyy-MM-dd HH:mm:ss";
[Description("日期格式化掩码"), Category("自定义")]
[DefaultValue("yyyy-MM-dd HH:mm:ss")]
public string DateFormat
{
get => dateFormat;
set
{
dateFormat = value;
Text = Value.ToString(dateFormat);
}
}
}
}

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

@ -239,6 +239,7 @@ namespace Sunny.UI
if (Nodes.Count > 0 && value >= 0 && value < Nodes.Count)
{
selectedIndex = value;
NodeMouseClick?.Invoke(Nodes[SelectedIndex], selectedIndex, MenuHelper.GetPageIndex(Nodes[SelectedIndex]));
if (Nodes[value].Nodes.Count == 0)
{
@ -283,7 +284,7 @@ namespace Sunny.UI
break;
case StringAlignment.Center:
NodeX = (Width - Nodes.Count * NodeSize.Width) * 2;
NodeX = (Width - Nodes.Count * NodeSize.Width) / 2;
break;
case StringAlignment.Far:
@ -295,7 +296,11 @@ namespace Sunny.UI
{
Rectangle rect = new Rectangle(NodeX + i * NodeSize.Width, NodeY, NodeSize.Width, NodeSize.Height);
SizeF sf = e.Graphics.MeasureString(Nodes[i].Text, Font);
TreeNode node = Nodes[i];
int symbol = MenuHelper.GetSymbol(node);
int symbolSize = MenuHelper.GetSymbolSize(node);
SizeF sf = e.Graphics.MeasureString(node.Text, Font);
Color textColor = ForeColor;
if (i == ActiveIndex)
@ -308,14 +313,23 @@ namespace Sunny.UI
{
if (!NavBarMenu.Visible)
{
e.Graphics.FillRectangle(new SolidBrush(SelectedHighColor), rect.X, Height - 4, rect.Width, 4);
e.Graphics.FillRectangle(SelectedHighColor, rect.X, Height - 4, rect.Width, 4);
}
textColor = SelectedForeColor;
}
e.Graphics.DrawString(Nodes[i].Text, Font, new SolidBrush(textColor), NodeX + i * NodeSize.Width + (NodeSize.Width - sf.Width) / 2.0f, NodeY + (NodeSize.Height - sf.Height) / 2);
if (Nodes[i].Nodes.Count > 0)
if (symbol > 0)
{
e.Graphics.DrawFontImage(symbol, symbolSize, textColor, new RectangleF(NodeX + i * NodeSize.Width + (NodeSize.Width - sf.Width - symbolSize) / 2.0f, NodeY, symbolSize, NodeSize.Height));
e.Graphics.DrawString(node.Text, Font, textColor, NodeX + i * NodeSize.Width + (NodeSize.Width - sf.Width + symbolSize) / 2.0f, NodeY + (NodeSize.Height - sf.Height) / 2);
}
else
{
e.Graphics.DrawString(node.Text, Font, textColor, NodeX + i * NodeSize.Width + (NodeSize.Width - sf.Width) / 2.0f, NodeY + (NodeSize.Height - sf.Height) / 2);
}
if (node.Nodes.Count > 0)
{
SizeF imageSize = e.Graphics.GetFontImageSize(61703, 24);
if (i != SelectedIndex)
@ -414,7 +428,7 @@ namespace Sunny.UI
NavBarMenu.Items.Clear();
foreach (TreeNode node in Nodes[SelectedIndex].Nodes)
{
ToolStripMenuItem item = new ToolStripMenuItem(node.Text) { Tag = node.Tag };
ToolStripMenuItem item = new ToolStripMenuItem(node.Text) { Tag = node };
item.Click += Item_Click;
NavBarMenu.Items.Add(item);
@ -444,22 +458,28 @@ namespace Sunny.UI
private void Item_Click(object sender, EventArgs e)
{
ToolStripMenuItem item = (ToolStripMenuItem)sender;
if (item.Tag != null && item.Tag is NavMenuItem mi)
if (item.Tag != null && item.Tag is TreeNode node)
{
TabControl?.SelectPage(mi.PageIndex);
MenuItemClick?.Invoke(item.Text, selectedIndex, mi.PageIndex);
TabControl?.SelectPage(MenuHelper.GetPageIndex(node));
MenuItemClick?.Invoke(item.Text, selectedIndex, MenuHelper.GetPageIndex(node));
NodeMouseClick?.Invoke(node, selectedIndex, MenuHelper.GetPageIndex(node));
}
}
public delegate void OnMenuItemClick(string text, int menuIndex, int pageIndex);
public delegate void OnMenuItemClick(string itemText, int menuIndex, int pageIndex);
public event OnMenuItemClick MenuItemClick;
public delegate void OnNodeMouseClick(TreeNode node, int menuIndex, int pageIndex);
public event OnNodeMouseClick NodeMouseClick;
private void AddMenu(ToolStripMenuItem item, TreeNode node)
{
foreach (TreeNode childNode in node.Nodes)
{
ToolStripMenuItem childItem = new ToolStripMenuItem(childNode.Text) { Tag = childNode.Tag };
ToolStripMenuItem childItem = new ToolStripMenuItem(childNode.Text) { Tag = childNode };
childItem.Click += Item_Click;
item.DropDownItems.Add(childItem);
if (childNode.Nodes.Count > 0)

View File

@ -288,6 +288,32 @@ namespace Sunny.UI
}
}
private bool showCloseButton;
[DefaultValue(false)]
public bool ShowCloseButton
{
get => showCloseButton;
set
{
showCloseButton = value;
Invalidate();
}
}
private bool showActiveCloseButton;
[DefaultValue(false)]
public bool ShowActiveCloseButton
{
get => showActiveCloseButton;
set
{
showActiveCloseButton = value;
Invalidate();
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
@ -324,6 +350,10 @@ namespace Sunny.UI
}
g.DrawString(TabPages[index].Text, Font, index == SelectedIndex ? tabSelectedForeColor : TabUnSelectedForeColor, textLeft, TabRect.Top + 2 + (TabRect.Height - sf.Height) / 2.0f);
if (ShowCloseButton || (ShowActiveCloseButton && index == SelectedIndex))
{
g.DrawFontImage(61453, 20, index == SelectedIndex ? tabSelectedForeColor : TabUnSelectedForeColor, new Rectangle(TabRect.Width - 28, TabRect.Top, 24, TabRect.Height));
}
// 绘制图标
if (ImageList != null)
@ -345,6 +375,56 @@ namespace Sunny.UI
}
}
protected override void OnMouseClick(MouseEventArgs e)
{
base.OnMouseClick(e);
int removeIndex = -1;
for (int index = 0; index <= TabCount - 1; index++)
{
Rectangle TabRect = new Rectangle(GetTabRect(index).Location.X - 2, GetTabRect(index).Location.Y - 2, ItemSize.Width, ItemSize.Height);
Rectangle rect = new Rectangle(TabRect.Right - 28, TabRect.Top, 24, TabRect.Height);
if (e.Location.InRect(rect))
{
removeIndex = index;
break;
}
}
if (removeIndex < 0 || removeIndex >= TabCount)
{
return;
}
if (ShowCloseButton || (ShowActiveCloseButton && removeIndex == SelectedIndex))
{
if (BeforeRemoveTabPage == null || (BeforeRemoveTabPage != null && BeforeRemoveTabPage.Invoke(this, removeIndex)))
{
RemoveTabPage(removeIndex);
}
}
}
public delegate bool OnBeforeRemoveTabPage(object sender, int index);
public delegate void OnAfterRemoveTabPage(object sender, int index);
public event OnBeforeRemoveTabPage BeforeRemoveTabPage;
public event OnAfterRemoveTabPage AfterRemoveTabPage;
internal void RemoveTabPage(int index)
{
if (index < 0 || index >= TabCount)
{
return;
}
TabPages.Remove(TabPages[index]);
AfterRemoveTabPage?.Invoke(this, index);
if (TabCount == 0) return;
if (index == 0) SelectedIndex = 0;
if (index > 0) SelectedIndex = index - 1;
}
public enum UITabPosition
{
Left,

View File

@ -150,6 +150,23 @@ namespace Sunny.UI
rect.Top + ((rect.Height - sf.Height) / 2.0f).RoundEx(), xOffset, yOffSet);
}
/// <summary>
/// 绘制字体图片
/// </summary>
/// <param name="graphics">GDI绘图</param>
/// <param name="symbol">字符</param>
/// <param name="symbolSize">大小</param>
/// <param name="color">颜色</param>
/// <param name="rect">区域</param>
/// <param name="xOffset">左右偏移</param>
/// <param name="yOffSet">上下偏移</param>
public static void DrawFontImage(this Graphics graphics, int symbol, int symbolSize, Color color, RectangleF rect, int xOffset = 0, int yOffSet = 0)
{
SizeF sf = graphics.GetFontImageSize(symbol, symbolSize);
graphics.DrawFontImage(symbol, symbolSize, color, rect.Left + ((rect.Width - sf.Width) / 2.0f).RoundEx(),
rect.Top + ((rect.Height - sf.Height) / 2.0f).RoundEx(), xOffset, yOffSet);
}
/// <summary>
/// ´´½¨Í¼Æ¬
/// </summary>

View File

@ -91,6 +91,9 @@
<Compile Include="Controls\DropItem\UIColorItem.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\UIDatetimePicker.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\UITimePicker.cs">
<SubType>UserControl</SubType>
</Compile>
@ -461,6 +464,9 @@
<EmbeddedResource Include="Controls\DropItem\UITimeItem.resx">
<DependentUpon>UITimeItem.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\UIDatetimePicker.resx">
<DependentUpon>UIDatetimePicker.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\UITimePicker.resx">
<DependentUpon>UITimePicker.cs</DependentUpon>
</EmbeddedResource>

View File

@ -1,5 +1,10 @@
+ 增加; - 删除; * 修改
2020.06.02
+ UIDatetimePicker新增
* UITabControl新增关闭按钮
* UINavBar修改未设置PageIndex不相应按钮事件
2020.05.31
+ UIColorPicker新增