From a4acdf6a5083aa93b900369e21b83bf6f88265b6 Mon Sep 17 00:00:00 2001 From: H Date: Sat, 22 Aug 2020 11:45:41 +0800 Subject: [PATCH 1/6] =?UTF-8?q?listbox=E4=BC=98=E5=8C=96=E6=BB=9A=E8=BD=AE?= =?UTF-8?q?=E5=BF=AB=E9=80=9F=E6=BB=9A=E5=8A=A8=E6=B5=81=E7=95=85=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI.Demo/Controls/FListBox.cs | 2 +- SunnyUI/Controls/UIListBox.cs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/SunnyUI.Demo/Controls/FListBox.cs b/SunnyUI.Demo/Controls/FListBox.cs index b84ea93b..173c71ab 100644 --- a/SunnyUI.Demo/Controls/FListBox.cs +++ b/SunnyUI.Demo/Controls/FListBox.cs @@ -13,7 +13,7 @@ namespace Sunny.UI.Demo public override void Init() { uiListBox1.Items.Clear(); - for (int i = 0; i < 20; i++) + for (int i = 0; i < 50; i++) { uiListBox1.Items.Add(i); } diff --git a/SunnyUI/Controls/UIListBox.cs b/SunnyUI/Controls/UIListBox.cs index 63b57ced..9fb89305 100644 --- a/SunnyUI/Controls/UIListBox.cs +++ b/SunnyUI/Controls/UIListBox.cs @@ -395,13 +395,16 @@ namespace Sunny.UI if (Bar != null && Bar.Visible) { var si = ScrollBarInfo.GetInfo(Handle); + int temp = Math.Abs(e.Delta / 120); if (e.Delta > 10) { - ScrollBarInfo.SetScrollValue(Handle, (si.nPos - SystemInformation.MouseWheelScrollLines) >= si.nMin ? si.nPos - SystemInformation.MouseWheelScrollLines : 0); + int nposnum = si.nPos - temp * SystemInformation.MouseWheelScrollLines; + ScrollBarInfo.SetScrollValue(Handle, nposnum >= si.nMin ? nposnum : 0); } else if (e.Delta < -10) { - ScrollBarInfo.SetScrollValue(Handle, (si.nPos + SystemInformation.MouseWheelScrollLines) <= si.nMax ? (si.nPos + SystemInformation.MouseWheelScrollLines) : si.nMax); + int nposnum = si.nPos + temp * SystemInformation.MouseWheelScrollLines; + ScrollBarInfo.SetScrollValue(Handle, nposnum <= si.nMax ? nposnum : si.nMax); } } From 609488137c961dfbf943462dbe6be2543560faf8 Mon Sep 17 00:00:00 2001 From: H Date: Sat, 22 Aug 2020 18:31:20 +0800 Subject: [PATCH 2/6] =?UTF-8?q?button=20=E7=A9=BA=E6=A0=BC=E9=94=AE?= =?UTF-8?q?=E6=8C=89=E4=B8=8Bpress=E8=83=8C=E6=99=AF=E6=95=88=E6=9E=9C=20i?= =?UTF-8?q?magelistbox=20=E6=BB=9A=E5=8A=A8=E6=9D=A1bug=20=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E6=8E=A7=E4=BB=B6=20=E5=BD=93=E5=89=8D=E9=A1=B5?= =?UTF-8?q?=E4=B8=BA=E9=A6=96=E9=A1=B5=E6=88=96=E8=80=85=E6=9C=80=E5=90=8E?= =?UTF-8?q?=E9=A1=B5=E6=97=B6=EF=BC=8C=E4=B8=8A=E4=B8=80=E9=A1=B5=E6=88=96?= =?UTF-8?q?=E8=80=85=E4=B8=8B=E4=B8=80=E9=A1=B5=E6=8C=89=E9=92=AEenable?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BAfalse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controls/FDataGridView.Designer.cs | 5 ++-- SunnyUI/Controls/UIButton.cs | 10 ++++++++ SunnyUI/Controls/UIImageListBox.cs | 24 +++++++++++-------- SunnyUI/Controls/UIListBox.cs | 5 ++-- SunnyUI/Controls/UIPagination.cs | 20 ++++++++++++++-- 5 files changed, 46 insertions(+), 18 deletions(-) diff --git a/SunnyUI.Demo/Controls/FDataGridView.Designer.cs b/SunnyUI.Demo/Controls/FDataGridView.Designer.cs index 359a0052..5273ee8f 100644 --- a/SunnyUI.Demo/Controls/FDataGridView.Designer.cs +++ b/SunnyUI.Demo/Controls/FDataGridView.Designer.cs @@ -80,7 +80,6 @@ this.uiDataGridView1.Location = new System.Drawing.Point(0, 0); this.uiDataGridView1.MultiSelect = false; this.uiDataGridView1.Name = "uiDataGridView1"; - this.uiDataGridView1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); this.uiDataGridView1.RowHeadersVisible = false; dataGridViewCellStyle4.BackColor = System.Drawing.Color.White; this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle4; @@ -90,11 +89,10 @@ this.uiDataGridView1.ShowRect = false; this.uiDataGridView1.Size = new System.Drawing.Size(861, 380); this.uiDataGridView1.TabIndex = 0; - this.uiDataGridView1.TagString = null; // // uiPagination1 // - this.uiPagination1.ActivePage = 500; + this.uiPagination1.ActivePage = 50; this.uiPagination1.CausesValidation = false; this.uiPagination1.Dock = System.Windows.Forms.DockStyle.Bottom; this.uiPagination1.Font = new System.Drawing.Font("微软雅黑", 12F); @@ -102,6 +100,7 @@ this.uiPagination1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.uiPagination1.Name = "uiPagination1"; this.uiPagination1.PagerCount = 11; + this.uiPagination1.PageSize = 50; this.uiPagination1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None; this.uiPagination1.Size = new System.Drawing.Size(861, 35); this.uiPagination1.TabIndex = 1; diff --git a/SunnyUI/Controls/UIButton.cs b/SunnyUI/Controls/UIButton.cs index 64aa9332..e29ab29f 100644 --- a/SunnyUI/Controls/UIButton.cs +++ b/SunnyUI/Controls/UIButton.cs @@ -382,12 +382,22 @@ namespace Sunny.UI { if (Focused && e.KeyCode == Keys.Space) { + IsPress = true; + Invalidate(); PerformClick(); } base.OnKeyDown(e); } + protected override void OnKeyUp(KeyEventArgs e) + { + IsPress = false; + Invalidate(); + + base.OnKeyUp(e); + } + [DefaultValue(false)] [Description("显示激活时边框线"), Category("SunnyUI")] public bool ShowFocusLine { get; set; } diff --git a/SunnyUI/Controls/UIImageListBox.cs b/SunnyUI/Controls/UIImageListBox.cs index ebc191bb..de7b6e8f 100644 --- a/SunnyUI/Controls/UIImageListBox.cs +++ b/SunnyUI/Controls/UIImageListBox.cs @@ -321,7 +321,14 @@ namespace Sunny.UI protected override void OnSizeChanged(EventArgs e) { - SetScrollInfo(); + if (Bar != null && Bar.Visible) + { + if (Bar.Value != 0) + { + ScrollBarInfo.SetScrollValue(Handle, Bar.Value); + } + } + //SetScrollInfo(); } public void SetScrollInfo() @@ -379,22 +386,19 @@ namespace Sunny.UI { base.OnMouseWheel(e); - if (Bar.Visible) + if (Bar != null && Bar.Visible) { var si = ScrollBarInfo.GetInfo(Handle); + int temp = Math.Abs(e.Delta / 120); if (e.Delta > 10) { - if (si.nPos > 0) - { - ScrollBarInfo.ScrollUp(Handle); - } + int nposnum = si.nPos - temp * SystemInformation.MouseWheelScrollLines; + ScrollBarInfo.SetScrollValue(Handle, nposnum >= si.nMin ? nposnum : 0); } else if (e.Delta < -10) { - if (si.nPos < si.ScrollMax) - { - ScrollBarInfo.ScrollDown(Handle); - } + int nposnum = si.nPos + temp * SystemInformation.MouseWheelScrollLines; + ScrollBarInfo.SetScrollValue(Handle, nposnum <= si.nMax ? nposnum : si.nMax); } } diff --git a/SunnyUI/Controls/UIListBox.cs b/SunnyUI/Controls/UIListBox.cs index 9fb89305..086b9589 100644 --- a/SunnyUI/Controls/UIListBox.cs +++ b/SunnyUI/Controls/UIListBox.cs @@ -404,11 +404,10 @@ namespace Sunny.UI else if (e.Delta < -10) { int nposnum = si.nPos + temp * SystemInformation.MouseWheelScrollLines; - ScrollBarInfo.SetScrollValue(Handle, nposnum <= si.nMax ? nposnum : si.nMax); + ScrollBarInfo.SetScrollValue(Handle, nposnum <= si.ScrollMax ? nposnum : si.ScrollMax); } + SetScrollInfo(); } - - SetScrollInfo(); } public void SetStyle(UIStyle style) diff --git a/SunnyUI/Controls/UIPagination.cs b/SunnyUI/Controls/UIPagination.cs index d970dceb..a083dc94 100644 --- a/SunnyUI/Controls/UIPagination.cs +++ b/SunnyUI/Controls/UIPagination.cs @@ -703,8 +703,24 @@ namespace Sunny.UI edtPage.HasMaximum = true; edtPage.Maximum = PageCount; - if (activePage > PageCount) activePage = PageCount; - if (activePage < 1) activePage = 1; + if (activePage >= PageCount) + { + activePage = PageCount; + b16.Enabled = false; + } + else + { + b16.Enabled = true; + } + if (activePage <= 1) + { + activePage = 1; + b0.Enabled = false; + } + else + { + b0.Enabled = true; + } edtPage.IntValue = activePage; if (TotalCount == 0) From e7f62d9b9bdcf742b5fbe403bfee271e87e48fb6 Mon Sep 17 00:00:00 2001 From: H Date: Sat, 22 Aug 2020 19:47:24 +0800 Subject: [PATCH 3/6] =?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 4/6] =?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 5/6] =?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")] From 72a7bcf176db41c222f31ad45986c2798e44de99 Mon Sep 17 00:00:00 2001 From: TAOQIJH <1298758589@qq.com> Date: Mon, 24 Aug 2020 12:06:46 +0800 Subject: [PATCH 6/6] =?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")]