diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index c73995ee..154ea2c1 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb index 9ddd2b1a..6930a108 100644 Binary files a/Bin/SunnyUI.pdb and b/Bin/SunnyUI.pdb differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe index 1a9cb239..6c7653d6 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe and b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.dll b/SunnyUI.Demo/Bin/SunnyUI.dll index c73995ee..154ea2c1 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.dll and b/SunnyUI.Demo/Bin/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Controls/FCheckBox.Designer.cs b/SunnyUI.Demo/Controls/FCheckBox.Designer.cs index 243fcb3b..cb43dad6 100644 --- a/SunnyUI.Demo/Controls/FCheckBox.Designer.cs +++ b/SunnyUI.Demo/Controls/FCheckBox.Designer.cs @@ -34,11 +34,17 @@ this.uiCheckBox4 = new Sunny.UI.UICheckBox(); this.uiCheckBox2 = new Sunny.UI.UICheckBox(); this.uiCheckBoxGroup1 = new Sunny.UI.UICheckBoxGroup(); + this.uiButton1 = new Sunny.UI.UIButton(); + this.uiButton2 = new Sunny.UI.UIButton(); + this.uiButton3 = new Sunny.UI.UIButton(); this.PagePanel.SuspendLayout(); this.SuspendLayout(); // // PagePanel // + this.PagePanel.Controls.Add(this.uiButton3); + this.PagePanel.Controls.Add(this.uiButton2); + this.PagePanel.Controls.Add(this.uiButton1); this.PagePanel.Controls.Add(this.uiCheckBoxGroup1); this.PagePanel.Controls.Add(this.uiCheckBox2); this.PagePanel.Controls.Add(this.uiCheckBox4); @@ -129,6 +135,39 @@ this.uiCheckBoxGroup1.Text = "UICheckBoxGroup"; this.uiCheckBoxGroup1.ValueChanged += new Sunny.UI.UICheckBoxGroup.OnValueChanged(this.uiCheckBoxGroup1_ValueChanged); // + // uiButton1 + // + this.uiButton1.Cursor = System.Windows.Forms.Cursors.Hand; + this.uiButton1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiButton1.Location = new System.Drawing.Point(30, 310); + this.uiButton1.Name = "uiButton1"; + this.uiButton1.Size = new System.Drawing.Size(100, 35); + this.uiButton1.TabIndex = 42; + this.uiButton1.Text = "全选"; + this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click); + // + // uiButton2 + // + this.uiButton2.Cursor = System.Windows.Forms.Cursors.Hand; + this.uiButton2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiButton2.Location = new System.Drawing.Point(136, 310); + this.uiButton2.Name = "uiButton2"; + this.uiButton2.Size = new System.Drawing.Size(100, 35); + this.uiButton2.TabIndex = 43; + this.uiButton2.Text = "全不选"; + this.uiButton2.Click += new System.EventHandler(this.uiButton2_Click); + // + // uiButton3 + // + this.uiButton3.Cursor = System.Windows.Forms.Cursors.Hand; + this.uiButton3.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiButton3.Location = new System.Drawing.Point(242, 310); + this.uiButton3.Name = "uiButton3"; + this.uiButton3.Size = new System.Drawing.Size(100, 35); + this.uiButton3.TabIndex = 44; + this.uiButton3.Text = "反选"; + this.uiButton3.Click += new System.EventHandler(this.uiButton3_Click); + // // FCheckBox // this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); @@ -150,5 +189,8 @@ private UICheckBox uiCheckBox3; private UICheckBox uiCheckBox2; private UICheckBoxGroup uiCheckBoxGroup1; + private UIButton uiButton3; + private UIButton uiButton2; + private UIButton uiButton1; } } \ No newline at end of file diff --git a/SunnyUI.Demo/Controls/FCheckBox.cs b/SunnyUI.Demo/Controls/FCheckBox.cs index 840ff7cb..99edf237 100644 --- a/SunnyUI.Demo/Controls/FCheckBox.cs +++ b/SunnyUI.Demo/Controls/FCheckBox.cs @@ -1,4 +1,5 @@ -using System.Text; +using System; +using System.Text; using System.Windows.Forms; namespace Sunny.UI.Demo @@ -10,11 +11,6 @@ namespace Sunny.UI.Demo InitializeComponent(); } - private void uiRadioButtonGroup1_ValueChanged(object sender, int index, string text) - { - MessageBox.Show(index.ToString()); - } - private void uiCheckBoxGroup1_ValueChanged(object sender, int index, string text, bool isChecked) { StringBuilder sb = new StringBuilder(); @@ -25,7 +21,22 @@ namespace Sunny.UI.Demo sb.Append(", "); } - this.ShowInfoDialog("SelectedIndex: " + index + ", SelectedText: " + text + "\n" + sb.ToString()); + this.ShowSuccessTip("SelectedIndex: " + index + ", SelectedText: " + text + "\n" + sb.ToString()); + } + + private void uiButton1_Click(object sender, System.EventArgs e) + { + uiCheckBoxGroup1.SelectAll(); + } + + private void uiButton2_Click(object sender, System.EventArgs e) + { + uiCheckBoxGroup1.UnSelectAll(); + } + + private void uiButton3_Click(object sender, System.EventArgs e) + { + uiCheckBoxGroup1.ReverseSelected(); } } } \ No newline at end of file diff --git a/SunnyUI/Controls/UICheckBoxGroup.cs b/SunnyUI/Controls/UICheckBoxGroup.cs index ddc18afc..e7615f65 100644 --- a/SunnyUI/Controls/UICheckBoxGroup.cs +++ b/SunnyUI/Controls/UICheckBoxGroup.cs @@ -139,7 +139,11 @@ namespace Sunny.UI private void Box_ValueChanged(object sender, bool value) { UICheckBox checkBox = (UICheckBox)sender; - ValueChanged?.Invoke(this, checkBox.Tag.ToString().ToInt(), checkBox.Text, checkBox.Checked); + + if (!multiChange) + { + ValueChanged?.Invoke(this, checkBox.Tag.ToString().ToInt(), checkBox.Text, checkBox.Checked); + } } [Browsable(false)] @@ -251,5 +255,49 @@ namespace Sunny.UI box.Font = Font; } } + + /// + /// 全部选择 + /// + public void SelectAll() + { + multiChange = true; + foreach (var box in boxes) + { + box.Checked = true; + } + + multiChange = false; + } + + /// + /// 全部不选 + /// + public void UnSelectAll() + { + multiChange = true; + foreach (var box in boxes) + { + box.Checked = false; + } + + multiChange = false; + } + + /// + /// 反转选择 + /// + public void ReverseSelected() + { + multiChange = true; + foreach (var box in boxes) + { + box.Checked = !box.Checked; + } + + multiChange = false; + } + + private bool multiChange; } } \ No newline at end of file diff --git a/Updates.txt b/Updates.txt index 1634c572..43b7d846 100644 --- a/Updates.txt +++ b/Updates.txt @@ -1,5 +1,8 @@ + ӣ - ɾ * ޸ +2020.06.24 ++ UICheckBoxGroupȫѡȫѡѡ + 2020.06.23 * UIButtonShowFocusLineɻý㲢ʾ