diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index 965b70fd..1f1e8ba8 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb index c21a7265..4aec4489 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 ed81f3b9..9ad75866 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 965b70fd..1f1e8ba8 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 cb43dad6..6c1e03b2 100644 --- a/SunnyUI.Demo/Controls/FCheckBox.Designer.cs +++ b/SunnyUI.Demo/Controls/FCheckBox.Designer.cs @@ -28,6 +28,7 @@ /// private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FCheckBox)); this.uiCheckBox1 = new Sunny.UI.UICheckBox(); this.uiLine1 = new Sunny.UI.UILine(); this.uiCheckBox3 = new Sunny.UI.UICheckBox(); @@ -37,11 +38,13 @@ this.uiButton1 = new Sunny.UI.UIButton(); this.uiButton2 = new Sunny.UI.UIButton(); this.uiButton3 = new Sunny.UI.UIButton(); + this.uiButton4 = new Sunny.UI.UIButton(); this.PagePanel.SuspendLayout(); this.SuspendLayout(); // // PagePanel // + this.PagePanel.Controls.Add(this.uiButton4); this.PagePanel.Controls.Add(this.uiButton3); this.PagePanel.Controls.Add(this.uiButton2); this.PagePanel.Controls.Add(this.uiButton1); @@ -130,6 +133,7 @@ this.uiCheckBoxGroup1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.uiCheckBoxGroup1.Name = "uiCheckBoxGroup1"; this.uiCheckBoxGroup1.Padding = new System.Windows.Forms.Padding(0, 32, 0, 0); + this.uiCheckBoxGroup1.SelectedIndexes = ((System.Collections.Generic.List)(resources.GetObject("uiCheckBoxGroup1.SelectedIndexes"))); this.uiCheckBoxGroup1.Size = new System.Drawing.Size(670, 211); this.uiCheckBoxGroup1.TabIndex = 41; this.uiCheckBoxGroup1.Text = "UICheckBoxGroup"; @@ -168,6 +172,17 @@ this.uiButton3.Text = "反选"; this.uiButton3.Click += new System.EventHandler(this.uiButton3_Click); // + // uiButton4 + // + this.uiButton4.Cursor = System.Windows.Forms.Cursors.Hand; + this.uiButton4.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiButton4.Location = new System.Drawing.Point(348, 310); + this.uiButton4.Name = "uiButton4"; + this.uiButton4.Size = new System.Drawing.Size(100, 35); + this.uiButton4.TabIndex = 45; + this.uiButton4.Text = "选择"; + this.uiButton4.Click += new System.EventHandler(this.uiButton4_Click); + // // FCheckBox // this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); @@ -176,6 +191,7 @@ this.Name = "FCheckBox"; this.Symbol = 61770; this.Text = "CheckBox"; + this.Shown += new System.EventHandler(this.FCheckBox_Shown); this.PagePanel.ResumeLayout(false); this.ResumeLayout(false); @@ -192,5 +208,6 @@ private UIButton uiButton3; private UIButton uiButton2; private UIButton uiButton1; + private UIButton uiButton4; } } \ No newline at end of file diff --git a/SunnyUI.Demo/Controls/FCheckBox.cs b/SunnyUI.Demo/Controls/FCheckBox.cs index 99edf237..0f0a344f 100644 --- a/SunnyUI.Demo/Controls/FCheckBox.cs +++ b/SunnyUI.Demo/Controls/FCheckBox.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Text; using System.Windows.Forms; @@ -38,5 +39,15 @@ namespace Sunny.UI.Demo { uiCheckBoxGroup1.ReverseSelected(); } + + private void FCheckBox_Shown(object sender, EventArgs e) + { + uiCheckBoxGroup1.SelectedIndexes = new List() { 2, 4 }; + } + + private void uiButton4_Click(object sender, EventArgs e) + { + uiCheckBoxGroup1.SelectedIndexes = new List() { 2, 4 }; + } } } \ No newline at end of file diff --git a/SunnyUI.Demo/Controls/FCheckBox.resx b/SunnyUI.Demo/Controls/FCheckBox.resx index 1af7de15..a9d4ffb3 100644 --- a/SunnyUI.Demo/Controls/FCheckBox.resx +++ b/SunnyUI.Demo/Controls/FCheckBox.resx @@ -117,4 +117,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u + ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u + PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB + AAAAL1N5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLkludDMyAwAAAAZfaXRl + bXMFX3NpemUIX3ZlcnNpb24HAAAICAgCAAAACQMAAAAAAAAAAAAAAA8DAAAAAAAAAAgL + + \ No newline at end of file diff --git a/SunnyUI/Controls/UICheckBoxGroup.cs b/SunnyUI/Controls/UICheckBoxGroup.cs index 48029e4d..f2445b52 100644 --- a/SunnyUI/Controls/UICheckBoxGroup.cs +++ b/SunnyUI/Controls/UICheckBoxGroup.cs @@ -97,10 +97,8 @@ namespace Sunny.UI } } - protected override void OnPaint(PaintEventArgs e) + private void CreateBoxes() { - base.OnPaint(e); - if (Items.Count == 0) return; if (Items.Count != boxes.Count) { @@ -121,7 +119,15 @@ namespace Sunny.UI boxes.Add(box); } } + } + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + + CreateBoxes(); + + if (Items.Count == 0) return; int startX = StartPos.X; int startY = TitleTop + StartPos.Y; for (int i = 0; i < Items.Count; i++) @@ -163,6 +169,17 @@ namespace Sunny.UI return indexes; } + set + { + if (boxes.Count==0) return; + foreach (int i in value) + { + if (i >= 0 && i < boxes.Count) + { + boxes[i].Checked = true; + } + } + } } [Browsable(false)] diff --git a/SunnyUI/Controls/UIRichTextBox.cs b/SunnyUI/Controls/UIRichTextBox.cs index c602cc10..351ec7eb 100644 --- a/SunnyUI/Controls/UIRichTextBox.cs +++ b/SunnyUI/Controls/UIRichTextBox.cs @@ -769,5 +769,23 @@ namespace Sunny.UI public event EventHandler SelectionChanged; #endregion RichTextBox + + #region TextBoxBase + public void ScrollToCaret() + { + edit.ScrollToCaret(); + } + + public void Select(int start, int length) + { + edit.Select(start,length); + } + + public void SelectAll() + { + edit.SelectAll(); + } + + #endregion } } \ No newline at end of file