* UIRichTextBox:增加一些函数

This commit is contained in:
Sunny 2020-07-04 14:09:49 +08:00
parent 3d8aa7cff9
commit 94de8e6962
9 changed files with 75 additions and 3 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -28,6 +28,7 @@
/// </summary>
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<int>)(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;
}
}

View File

@ -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<int>() { 2, 4 };
}
private void uiButton4_Click(object sender, EventArgs e)
{
uiCheckBoxGroup1.SelectedIndexes = new List<int>() { 2, 4 };
}
}
}

View File

@ -117,4 +117,13 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="uiCheckBoxGroup1.SelectedIndexes" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u
ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u
PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB
AAAAL1N5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLkludDMyAwAAAAZfaXRl
bXMFX3NpemUIX3ZlcnNpb24HAAAICAgCAAAACQMAAAAAAAAAAAAAAA8DAAAAAAAAAAgL
</value>
</data>
</root>

View File

@ -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)]

View File

@ -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
}
}