From e7f62d9b9bdcf742b5fbe403bfee271e87e48fb6 Mon Sep 17 00:00:00 2001 From: H Date: Sat, 22 Aug 2020 19:47:24 +0800 Subject: [PATCH 1/3] =?UTF-8?q?button=20=E6=B7=BB=E5=8A=A0=E5=8F=8C?= =?UTF-8?q?=E5=87=BB=E4=BA=8B=E4=BB=B6=EF=BC=8C=E8=A7=A3=E5=86=B3=E5=9B=A0?= =?UTF-8?q?=E5=BF=AB=E9=80=9F=E7=82=B9=E5=87=BB=E5=AF=BC=E8=87=B4=E6=95=88?= =?UTF-8?q?=E7=8E=87=E8=BF=87=E6=85=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI.Demo/Controls/FListBox.Designer.cs | 39 ++++++++++++++++++++++ SunnyUI.Demo/Controls/FListBox.cs | 25 +++++++++++--- SunnyUI/Controls/UIButton.cs | 6 ++++ 3 files changed, 66 insertions(+), 4 deletions(-) diff --git a/SunnyUI.Demo/Controls/FListBox.Designer.cs b/SunnyUI.Demo/Controls/FListBox.Designer.cs index ee41e37e..347f402e 100644 --- a/SunnyUI.Demo/Controls/FListBox.Designer.cs +++ b/SunnyUI.Demo/Controls/FListBox.Designer.cs @@ -34,11 +34,17 @@ this.uiListBox1 = new Sunny.UI.UIListBox(); this.uiCheckBox1 = new Sunny.UI.UICheckBox(); this.uiButton1 = new Sunny.UI.UIButton(); + this.button1 = new System.Windows.Forms.Button(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.uiButton2 = new Sunny.UI.UIButton(); this.PagePanel.SuspendLayout(); this.SuspendLayout(); // // PagePanel // + this.PagePanel.Controls.Add(this.uiButton2); + this.PagePanel.Controls.Add(this.listBox1); + this.PagePanel.Controls.Add(this.button1); this.PagePanel.Controls.Add(this.uiButton1); this.PagePanel.Controls.Add(this.uiCheckBox1); this.PagePanel.Controls.Add(this.uiListBox1); @@ -120,6 +126,36 @@ this.uiButton1.Text = "Add Item"; this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click); // + // button1 + // + this.button1.Location = new System.Drawing.Point(637, 400); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(112, 35); + this.button1.TabIndex = 24; + this.button1.Text = "Add Item"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // listBox1 + // + this.listBox1.FormattingEnabled = true; + this.listBox1.ItemHeight = 21; + this.listBox1.Location = new System.Drawing.Point(629, 48); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(138, 340); + this.listBox1.TabIndex = 25; + // + // uiButton2 + // + this.uiButton2.Cursor = System.Windows.Forms.Cursors.Hand; + this.uiButton2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiButton2.Location = new System.Drawing.Point(188, 400); + this.uiButton2.Name = "uiButton2"; + this.uiButton2.Size = new System.Drawing.Size(100, 35); + this.uiButton2.TabIndex = 26; + this.uiButton2.Text = "Clear Item"; + this.uiButton2.Click += new System.EventHandler(this.uiButton2_Click); + // // FListBox // this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); @@ -140,5 +176,8 @@ private UIListBox uiListBox1; private UICheckBox uiCheckBox1; private UIButton uiButton1; + private System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.Button button1; + private UIButton uiButton2; } } \ No newline at end of file diff --git a/SunnyUI.Demo/Controls/FListBox.cs b/SunnyUI.Demo/Controls/FListBox.cs index 173c71ab..0e3f7b72 100644 --- a/SunnyUI.Demo/Controls/FListBox.cs +++ b/SunnyUI.Demo/Controls/FListBox.cs @@ -13,10 +13,10 @@ namespace Sunny.UI.Demo public override void Init() { uiListBox1.Items.Clear(); - for (int i = 0; i < 50; i++) - { - uiListBox1.Items.Add(i); - } + //for (int i = 0; i < 50; i++) + //{ + // uiListBox1.Items.Add(i); + //} uiImageListBox1.Items.Clear(); string[] files = System.IO.Directory.GetFiles(DirEx.CurrentDir() + "Team", @@ -44,10 +44,27 @@ namespace Sunny.UI.Demo } private int num = 0; + private int num2 = 0; private void uiButton1_Click(object sender, System.EventArgs e) { + listBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_" + num2); + num2++; uiListBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_" + num); num++; } + + private void button1_Click(object sender, EventArgs e) + { + listBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_" + num2); + num2++; + uiListBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_" + num); + num++; + } + + private void uiButton2_Click(object sender, EventArgs e) + { + listBox1.Items.Clear(); + uiListBox1.Items.Clear(); + } } } \ No newline at end of file diff --git a/SunnyUI/Controls/UIButton.cs b/SunnyUI/Controls/UIButton.cs index e29ab29f..e90801ad 100644 --- a/SunnyUI/Controls/UIButton.cs +++ b/SunnyUI/Controls/UIButton.cs @@ -76,6 +76,12 @@ namespace Sunny.UI base.OnClick(e); } + protected override void OnDoubleClick(EventArgs e) + { + Focus(); + base.OnClick(e); + } + private bool showTips = false; [Description("是否显示角标"), Category("SunnyUI")] From 3848fd55c5e381ebf99417a7ce5e2e1df65a65cd Mon Sep 17 00:00:00 2001 From: H Date: Sun, 23 Aug 2020 08:14:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?Revert=20"button=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8F=8C=E5=87=BB=E4=BA=8B=E4=BB=B6=EF=BC=8C=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=9B=A0=E5=BF=AB=E9=80=9F=E7=82=B9=E5=87=BB=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=95=88=E7=8E=87=E8=BF=87=E6=85=A2=E9=97=AE=E9=A2=98"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit e7f62d9b9bdcf742b5fbe403bfee271e87e48fb6. --- SunnyUI.Demo/Controls/FListBox.Designer.cs | 39 ---------------------- SunnyUI.Demo/Controls/FListBox.cs | 25 +++----------- SunnyUI/Controls/UIButton.cs | 6 ---- 3 files changed, 4 insertions(+), 66 deletions(-) diff --git a/SunnyUI.Demo/Controls/FListBox.Designer.cs b/SunnyUI.Demo/Controls/FListBox.Designer.cs index 347f402e..ee41e37e 100644 --- a/SunnyUI.Demo/Controls/FListBox.Designer.cs +++ b/SunnyUI.Demo/Controls/FListBox.Designer.cs @@ -34,17 +34,11 @@ this.uiListBox1 = new Sunny.UI.UIListBox(); this.uiCheckBox1 = new Sunny.UI.UICheckBox(); this.uiButton1 = new Sunny.UI.UIButton(); - this.button1 = new System.Windows.Forms.Button(); - this.listBox1 = new System.Windows.Forms.ListBox(); - this.uiButton2 = new Sunny.UI.UIButton(); this.PagePanel.SuspendLayout(); this.SuspendLayout(); // // PagePanel // - this.PagePanel.Controls.Add(this.uiButton2); - this.PagePanel.Controls.Add(this.listBox1); - this.PagePanel.Controls.Add(this.button1); this.PagePanel.Controls.Add(this.uiButton1); this.PagePanel.Controls.Add(this.uiCheckBox1); this.PagePanel.Controls.Add(this.uiListBox1); @@ -126,36 +120,6 @@ this.uiButton1.Text = "Add Item"; this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click); // - // button1 - // - this.button1.Location = new System.Drawing.Point(637, 400); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(112, 35); - this.button1.TabIndex = 24; - this.button1.Text = "Add Item"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // listBox1 - // - this.listBox1.FormattingEnabled = true; - this.listBox1.ItemHeight = 21; - this.listBox1.Location = new System.Drawing.Point(629, 48); - this.listBox1.Name = "listBox1"; - this.listBox1.Size = new System.Drawing.Size(138, 340); - this.listBox1.TabIndex = 25; - // - // uiButton2 - // - this.uiButton2.Cursor = System.Windows.Forms.Cursors.Hand; - this.uiButton2.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiButton2.Location = new System.Drawing.Point(188, 400); - this.uiButton2.Name = "uiButton2"; - this.uiButton2.Size = new System.Drawing.Size(100, 35); - this.uiButton2.TabIndex = 26; - this.uiButton2.Text = "Clear Item"; - this.uiButton2.Click += new System.EventHandler(this.uiButton2_Click); - // // FListBox // this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); @@ -176,8 +140,5 @@ private UIListBox uiListBox1; private UICheckBox uiCheckBox1; private UIButton uiButton1; - private System.Windows.Forms.ListBox listBox1; - private System.Windows.Forms.Button button1; - private UIButton uiButton2; } } \ No newline at end of file diff --git a/SunnyUI.Demo/Controls/FListBox.cs b/SunnyUI.Demo/Controls/FListBox.cs index 0e3f7b72..173c71ab 100644 --- a/SunnyUI.Demo/Controls/FListBox.cs +++ b/SunnyUI.Demo/Controls/FListBox.cs @@ -13,10 +13,10 @@ namespace Sunny.UI.Demo public override void Init() { uiListBox1.Items.Clear(); - //for (int i = 0; i < 50; i++) - //{ - // uiListBox1.Items.Add(i); - //} + for (int i = 0; i < 50; i++) + { + uiListBox1.Items.Add(i); + } uiImageListBox1.Items.Clear(); string[] files = System.IO.Directory.GetFiles(DirEx.CurrentDir() + "Team", @@ -44,27 +44,10 @@ namespace Sunny.UI.Demo } private int num = 0; - private int num2 = 0; private void uiButton1_Click(object sender, System.EventArgs e) { - listBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_" + num2); - num2++; uiListBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_" + num); num++; } - - private void button1_Click(object sender, EventArgs e) - { - listBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_" + num2); - num2++; - uiListBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_" + num); - num++; - } - - private void uiButton2_Click(object sender, EventArgs e) - { - listBox1.Items.Clear(); - uiListBox1.Items.Clear(); - } } } \ No newline at end of file diff --git a/SunnyUI/Controls/UIButton.cs b/SunnyUI/Controls/UIButton.cs index e90801ad..e29ab29f 100644 --- a/SunnyUI/Controls/UIButton.cs +++ b/SunnyUI/Controls/UIButton.cs @@ -76,12 +76,6 @@ namespace Sunny.UI base.OnClick(e); } - protected override void OnDoubleClick(EventArgs e) - { - Focus(); - base.OnClick(e); - } - private bool showTips = false; [Description("是否显示角标"), Category("SunnyUI")] From 352e68fabd1a9dfe35611cad76cb3effee474a39 Mon Sep 17 00:00:00 2001 From: H Date: Sun, 23 Aug 2020 16:50:14 +0800 Subject: [PATCH 3/3] =?UTF-8?q?button=20=E6=B7=BB=E5=8A=A0'=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=90=AF=E7=94=A8=E5=8F=8C=E5=87=BB=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?'=E5=B1=9E=E6=80=A7=EF=BC=8C=E8=A7=A3=E5=86=B3=E8=BF=9E?= =?UTF-8?q?=E7=BB=AD=E7=82=B9=E5=87=BB=E6=95=88=E7=8E=87=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI.Demo/Controls/FListBox.Designer.cs | 1 + SunnyUI.Demo/Controls/FListBox.cs | 6 ++++++ SunnyUI/Controls/UIButton.cs | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/SunnyUI.Demo/Controls/FListBox.Designer.cs b/SunnyUI.Demo/Controls/FListBox.Designer.cs index ee41e37e..ae31af34 100644 --- a/SunnyUI.Demo/Controls/FListBox.Designer.cs +++ b/SunnyUI.Demo/Controls/FListBox.Designer.cs @@ -119,6 +119,7 @@ this.uiButton1.TabIndex = 23; this.uiButton1.Text = "Add Item"; this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click); + this.uiButton1.DoubleClick += new System.EventHandler(this.uiButton1_DoubleClick); // // FListBox // diff --git a/SunnyUI.Demo/Controls/FListBox.cs b/SunnyUI.Demo/Controls/FListBox.cs index 173c71ab..1165bbf7 100644 --- a/SunnyUI.Demo/Controls/FListBox.cs +++ b/SunnyUI.Demo/Controls/FListBox.cs @@ -49,5 +49,11 @@ namespace Sunny.UI.Demo uiListBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_" + num); num++; } + + private void uiButton1_DoubleClick(object sender, EventArgs e) + { + uiListBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_double_" + num); + num++; + } } } \ No newline at end of file diff --git a/SunnyUI/Controls/UIButton.cs b/SunnyUI/Controls/UIButton.cs index e29ab29f..f78e4ed0 100644 --- a/SunnyUI/Controls/UIButton.cs +++ b/SunnyUI/Controls/UIButton.cs @@ -55,6 +55,7 @@ namespace Sunny.UI fillHoverColor = UIStyles.Blue.ButtonFillHoverColor; fillPressColor = UIStyles.Blue.ButtonFillPressColor; fillSelectedColor = UIStyles.Blue.ButtonFillSelectedColor; + SetStyle(ControlStyles.StandardDoubleClick, UseDoubleClick); } private bool isClick; @@ -76,6 +77,27 @@ namespace Sunny.UI base.OnClick(e); } + private bool useDoubleClick = false; + + [Description("是否启用双击事件"), Category("SunnyUI")] + [DefaultValue(false)] + public bool UseDoubleClick + { + get + { + return useDoubleClick; + } + set + { + if (useDoubleClick != value) + { + useDoubleClick = value; + SetStyle(ControlStyles.StandardDoubleClick, value); + Invalidate(); + } + } + } + private bool showTips = false; [Description("是否显示角标"), Category("SunnyUI")]