diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe index a07b93fd..da07d2c0 100644 Binary files a/Bin/net40/SunnyUI.Demo.exe and b/Bin/net40/SunnyUI.Demo.exe differ diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index 0a4e7e84..597eb5ef 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Controls/FCheckBox.Designer.cs b/SunnyUI.Demo/Controls/FCheckBox.Designer.cs index 8334021c..43c77df3 100644 --- a/SunnyUI.Demo/Controls/FCheckBox.Designer.cs +++ b/SunnyUI.Demo/Controls/FCheckBox.Designer.cs @@ -41,6 +41,7 @@ namespace Sunny.UI.Demo this.uiCheckBox3 = new Sunny.UI.UICheckBox(); this.uiLine1 = new Sunny.UI.UILine(); this.uiCheckBox1 = new Sunny.UI.UICheckBox(); + this.uiButton6 = new Sunny.UI.UIButton(); this.SuspendLayout(); // // uiButton5 @@ -195,11 +196,24 @@ namespace Sunny.UI.Demo this.uiCheckBox1.Text = "uiCheckBox1"; this.uiCheckBox1.CheckedChanged += new System.EventHandler(this.uiCheckBox1_CheckedChanged); // + // uiButton6 + // + this.uiButton6.Cursor = System.Windows.Forms.Cursors.Hand; + this.uiButton6.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiButton6.Location = new System.Drawing.Point(560, 345); + this.uiButton6.MinimumSize = new System.Drawing.Size(1, 1); + this.uiButton6.Name = "uiButton6"; + this.uiButton6.Size = new System.Drawing.Size(100, 35); + this.uiButton6.TabIndex = 58; + this.uiButton6.Text = "单选"; + this.uiButton6.Click += new System.EventHandler(this.uiButton6_Click); + // // FCheckBox // this.AllowShowTitle = true; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(800, 521); + this.Controls.Add(this.uiButton6); this.Controls.Add(this.uiButton5); this.Controls.Add(this.uiButton4); this.Controls.Add(this.uiButton3); @@ -233,5 +247,6 @@ namespace Sunny.UI.Demo private UICheckBox uiCheckBox3; private UILine uiLine1; private UICheckBox uiCheckBox1; + private UIButton uiButton6; } } \ No newline at end of file diff --git a/SunnyUI.Demo/Controls/FCheckBox.cs b/SunnyUI.Demo/Controls/FCheckBox.cs index e17dbdbf..8393e9c7 100644 --- a/SunnyUI.Demo/Controls/FCheckBox.cs +++ b/SunnyUI.Demo/Controls/FCheckBox.cs @@ -54,5 +54,10 @@ namespace Sunny.UI.Demo { Console.WriteLine(uiCheckBox1.Checked); } + + private void uiButton6_Click(object sender, EventArgs e) + { + uiCheckBoxGroup1[4] = !uiCheckBoxGroup1[4]; + } } } diff --git a/SunnyUI/Controls/UICheckBoxGroup.cs b/SunnyUI/Controls/UICheckBoxGroup.cs index 6e41afe9..6e825df5 100644 --- a/SunnyUI/Controls/UICheckBoxGroup.cs +++ b/SunnyUI/Controls/UICheckBoxGroup.cs @@ -62,6 +62,12 @@ namespace Sunny.UI Invalidate(); } + public bool this[int index] + { + get => GetItemCheckState(index); + set => SetItemCheckState(index, value); + } + /// /// 析构事件 /// @@ -185,6 +191,22 @@ namespace Sunny.UI } } + public void SetItemCheckState(int index, bool isChecked) + { + if (index >= 0 && index < boxes.Count) + { + boxes[index].Checked = isChecked; + } + } + + public bool GetItemCheckState(int index) + { + if (index >= 0 && index < items.Count) + return boxes[index].Checked; + + return false; + } + //[Browsable(false)] //public List SelectedItems //{ @@ -207,15 +229,15 @@ namespace Sunny.UI { get { - List items = new List(); + List objects = new List(); for (int i = 0; i < boxes.Count; i++) { if (boxes[i].Checked) - items.Add(Items[i]); + objects.Add(Items[i]); } - return items; + return objects; } } diff --git a/SunnyUI/SunnyUI.csproj b/SunnyUI/SunnyUI.csproj index d632da6d..86169337 100644 --- a/SunnyUI/SunnyUI.csproj +++ b/SunnyUI/SunnyUI.csproj @@ -54,10 +54,6 @@ - - - - @@ -71,6 +67,10 @@ + + + + True