diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index e77d39f2..7973fe83 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb index 93e90695..c9a3eec7 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 832687c4..66ef1dff 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 e77d39f2..7973fe83 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.dll and b/SunnyUI.Demo/Bin/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Controls/FCombobox.Designer.cs b/SunnyUI.Demo/Controls/FCombobox.Designer.cs new file mode 100644 index 00000000..3a42cf04 --- /dev/null +++ b/SunnyUI.Demo/Controls/FCombobox.Designer.cs @@ -0,0 +1,249 @@ +namespace Sunny.UI.Demo +{ + partial class FCombobox + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.uiLine8 = new Sunny.UI.UILine(); + this.uiDatetimePicker1 = new Sunny.UI.UIDatetimePicker(); + this.uiColorPicker1 = new Sunny.UI.UIColorPicker(); + this.uiLine7 = new Sunny.UI.UILine(); + this.uiLine6 = new Sunny.UI.UILine(); + this.uiTimePicker1 = new Sunny.UI.UITimePicker(); + this.uiLine3 = new Sunny.UI.UILine(); + this.uiLine2 = new Sunny.UI.UILine(); + this.uiDatePicker1 = new Sunny.UI.UIDatePicker(); + this.uiComboBox2 = new Sunny.UI.UIComboBox(); + this.uiComboBox1 = new Sunny.UI.UIComboBox(); + this.PagePanel.SuspendLayout(); + this.SuspendLayout(); + // + // PagePanel + // + this.PagePanel.Controls.Add(this.uiLine8); + this.PagePanel.Controls.Add(this.uiDatetimePicker1); + this.PagePanel.Controls.Add(this.uiColorPicker1); + this.PagePanel.Controls.Add(this.uiLine7); + this.PagePanel.Controls.Add(this.uiLine6); + this.PagePanel.Controls.Add(this.uiTimePicker1); + this.PagePanel.Controls.Add(this.uiLine3); + this.PagePanel.Controls.Add(this.uiLine2); + this.PagePanel.Controls.Add(this.uiDatePicker1); + this.PagePanel.Controls.Add(this.uiComboBox2); + this.PagePanel.Controls.Add(this.uiComboBox1); + // + // uiLine8 + // + this.uiLine8.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLine8.Location = new System.Drawing.Point(388, 102); + this.uiLine8.MinimumSize = new System.Drawing.Size(16, 16); + this.uiLine8.Name = "uiLine8"; + this.uiLine8.Size = new System.Drawing.Size(306, 20); + this.uiLine8.TabIndex = 42; + this.uiLine8.Text = "UIDatetimePicker"; + this.uiLine8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // uiDatetimePicker1 + // + this.uiDatetimePicker1.FillColor = System.Drawing.Color.White; + this.uiDatetimePicker1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiDatetimePicker1.Location = new System.Drawing.Point(388, 136); + this.uiDatetimePicker1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.uiDatetimePicker1.MinimumSize = new System.Drawing.Size(63, 0); + this.uiDatetimePicker1.Name = "uiDatetimePicker1"; + this.uiDatetimePicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); + this.uiDatetimePicker1.Size = new System.Drawing.Size(306, 29); + this.uiDatetimePicker1.TabIndex = 41; + this.uiDatetimePicker1.Text = "2020-06-02 17:57:28"; + this.uiDatetimePicker1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + this.uiDatetimePicker1.Value = new System.DateTime(2020, 6, 2, 17, 57, 28, 203); + // + // uiColorPicker1 + // + this.uiColorPicker1.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; + this.uiColorPicker1.FillColor = System.Drawing.Color.White; + this.uiColorPicker1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiColorPicker1.Location = new System.Drawing.Point(388, 54); + this.uiColorPicker1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.uiColorPicker1.MinimumSize = new System.Drawing.Size(63, 0); + this.uiColorPicker1.Name = "uiColorPicker1"; + this.uiColorPicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); + this.uiColorPicker1.Size = new System.Drawing.Size(150, 29); + this.uiColorPicker1.TabIndex = 40; + this.uiColorPicker1.Text = "uiColorPicker1"; + this.uiColorPicker1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + this.uiColorPicker1.Value = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(159)))), ((int)(((byte)(254))))); + // + // uiLine7 + // + this.uiLine7.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLine7.Location = new System.Drawing.Point(388, 20); + this.uiLine7.MinimumSize = new System.Drawing.Size(16, 16); + this.uiLine7.Name = "uiLine7"; + this.uiLine7.Size = new System.Drawing.Size(306, 20); + this.uiLine7.TabIndex = 39; + this.uiLine7.Text = "UIColorPicker"; + this.uiLine7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // uiLine6 + // + this.uiLine6.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLine6.Location = new System.Drawing.Point(188, 102); + this.uiLine6.MinimumSize = new System.Drawing.Size(16, 16); + this.uiLine6.Name = "uiLine6"; + this.uiLine6.Size = new System.Drawing.Size(150, 20); + this.uiLine6.TabIndex = 38; + this.uiLine6.Text = "UITimePicker"; + this.uiLine6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // uiTimePicker1 + // + this.uiTimePicker1.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; + this.uiTimePicker1.FillColor = System.Drawing.Color.White; + this.uiTimePicker1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiTimePicker1.Location = new System.Drawing.Point(188, 136); + this.uiTimePicker1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.uiTimePicker1.MinimumSize = new System.Drawing.Size(63, 0); + this.uiTimePicker1.Name = "uiTimePicker1"; + this.uiTimePicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); + this.uiTimePicker1.Size = new System.Drawing.Size(150, 29); + this.uiTimePicker1.SymbolDropDown = 61555; + this.uiTimePicker1.SymbolNormal = 61555; + this.uiTimePicker1.TabIndex = 37; + this.uiTimePicker1.Text = "23:41:39"; + this.uiTimePicker1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + this.uiTimePicker1.Value = new System.DateTime(2020, 5, 29, 23, 41, 39, 684); + // + // uiLine3 + // + this.uiLine3.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLine3.Location = new System.Drawing.Point(30, 102); + this.uiLine3.MinimumSize = new System.Drawing.Size(16, 16); + this.uiLine3.Name = "uiLine3"; + this.uiLine3.Size = new System.Drawing.Size(150, 20); + this.uiLine3.TabIndex = 36; + this.uiLine3.Text = "UIDatePicker"; + this.uiLine3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // uiLine2 + // + this.uiLine2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLine2.Location = new System.Drawing.Point(30, 20); + this.uiLine2.MinimumSize = new System.Drawing.Size(16, 16); + this.uiLine2.Name = "uiLine2"; + this.uiLine2.Size = new System.Drawing.Size(308, 20); + this.uiLine2.TabIndex = 35; + this.uiLine2.Text = "UIComboBox"; + this.uiLine2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // uiDatePicker1 + // + this.uiDatePicker1.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; + this.uiDatePicker1.FillColor = System.Drawing.Color.White; + this.uiDatePicker1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiDatePicker1.Location = new System.Drawing.Point(30, 136); + this.uiDatePicker1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.uiDatePicker1.MinimumSize = new System.Drawing.Size(63, 0); + this.uiDatePicker1.Name = "uiDatePicker1"; + this.uiDatePicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); + this.uiDatePicker1.Size = new System.Drawing.Size(150, 29); + this.uiDatePicker1.SymbolDropDown = 61555; + this.uiDatePicker1.SymbolNormal = 61555; + this.uiDatePicker1.TabIndex = 34; + this.uiDatePicker1.Text = "2020-04-16"; + this.uiDatePicker1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + this.uiDatePicker1.Value = new System.DateTime(2020, 4, 16, 0, 0, 0, 0); + // + // uiComboBox2 + // + this.uiComboBox2.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; + this.uiComboBox2.FillColor = System.Drawing.Color.White; + this.uiComboBox2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiComboBox2.Items.AddRange(new object[] { + "1", + "2", + "3", + "4", + "5", + "6"}); + this.uiComboBox2.Location = new System.Drawing.Point(188, 54); + this.uiComboBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.uiComboBox2.MinimumSize = new System.Drawing.Size(63, 0); + this.uiComboBox2.Name = "uiComboBox2"; + this.uiComboBox2.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); + this.uiComboBox2.Size = new System.Drawing.Size(150, 29); + this.uiComboBox2.TabIndex = 33; + this.uiComboBox2.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + // + // uiComboBox1 + // + this.uiComboBox1.FillColor = System.Drawing.Color.White; + this.uiComboBox1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiComboBox1.Items.AddRange(new object[] { + "1", + "2", + "3", + "4", + "5", + "6"}); + this.uiComboBox1.Location = new System.Drawing.Point(30, 54); + this.uiComboBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.uiComboBox1.MinimumSize = new System.Drawing.Size(63, 0); + this.uiComboBox1.Name = "uiComboBox1"; + this.uiComboBox1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); + this.uiComboBox1.Size = new System.Drawing.Size(150, 29); + this.uiComboBox1.TabIndex = 32; + this.uiComboBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + this.uiComboBox1.Watermark = "水印文字"; + // + // FCombobox + // + this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Name = "FCombobox"; + this.Text = "Combobox"; + this.PagePanel.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private UILine uiLine8; + private UIDatetimePicker uiDatetimePicker1; + private UIColorPicker uiColorPicker1; + private UILine uiLine7; + private UILine uiLine6; + private UITimePicker uiTimePicker1; + private UILine uiLine3; + private UILine uiLine2; + private UIDatePicker uiDatePicker1; + private UIComboBox uiComboBox2; + private UIComboBox uiComboBox1; + } +} \ No newline at end of file diff --git a/SunnyUI.Demo/Controls/FCombobox.cs b/SunnyUI.Demo/Controls/FCombobox.cs new file mode 100644 index 00000000..3a405f67 --- /dev/null +++ b/SunnyUI.Demo/Controls/FCombobox.cs @@ -0,0 +1,15 @@ +using System; + +namespace Sunny.UI.Demo +{ + public partial class FCombobox : UITitlePage + { + public FCombobox() + { + InitializeComponent(); + uiDatePicker1.Value = DateTime.Today; + uiTimePicker1.Value = DateTime.Now; + uiDatetimePicker1.Value = DateTime.Now; + } + } +} diff --git a/SunnyUI.Demo/Controls/FCombobox.resx b/SunnyUI.Demo/Controls/FCombobox.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/SunnyUI.Demo/Controls/FCombobox.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SunnyUI.Demo/Controls/FTextBox.Designer.cs b/SunnyUI.Demo/Controls/FTextBox.Designer.cs index 73249f5e..0185e6b9 100644 --- a/SunnyUI.Demo/Controls/FTextBox.Designer.cs +++ b/SunnyUI.Demo/Controls/FTextBox.Designer.cs @@ -35,43 +35,27 @@ this.uiTextBox2 = new Sunny.UI.UITextBox(); this.uiLabel3 = new Sunny.UI.UILabel(); this.uiTextBox3 = new Sunny.UI.UITextBox(); - this.uiComboBox1 = new Sunny.UI.UIComboBox(); - this.uiComboBox2 = new Sunny.UI.UIComboBox(); - this.uiDatePicker1 = new Sunny.UI.UIDatePicker(); this.uiDoubleUpDown1 = new Sunny.UI.UIDoubleUpDown(); this.uiLine1 = new Sunny.UI.UILine(); - this.uiLine2 = new Sunny.UI.UILine(); - this.uiLine3 = new Sunny.UI.UILine(); this.uiLine4 = new Sunny.UI.UILine(); this.uiLine5 = new Sunny.UI.UILine(); - this.uiTimePicker1 = new Sunny.UI.UITimePicker(); - this.uiLine6 = new Sunny.UI.UILine(); - this.uiLine7 = new Sunny.UI.UILine(); - this.uiColorPicker1 = new Sunny.UI.UIColorPicker(); - this.uiDatetimePicker1 = new Sunny.UI.UIDatetimePicker(); - this.uiLine8 = new Sunny.UI.UILine(); - this.uiDatetimePicker2 = new Sunny.UI.UIDatetimePicker(); + this.uiRichTextBox1 = new Sunny.UI.UIRichTextBox(); + this.uiLine2 = new Sunny.UI.UILine(); + this.uiLine3 = new Sunny.UI.UILine(); + this.uiTextBox4 = new Sunny.UI.UITextBox(); this.PagePanel.SuspendLayout(); this.SuspendLayout(); // // PagePanel // - this.PagePanel.Controls.Add(this.uiDatetimePicker2); - this.PagePanel.Controls.Add(this.uiLine8); - this.PagePanel.Controls.Add(this.uiDatetimePicker1); - this.PagePanel.Controls.Add(this.uiColorPicker1); - this.PagePanel.Controls.Add(this.uiLine7); - this.PagePanel.Controls.Add(this.uiLine6); - this.PagePanel.Controls.Add(this.uiTimePicker1); - this.PagePanel.Controls.Add(this.uiLine5); - this.PagePanel.Controls.Add(this.uiLine4); + this.PagePanel.Controls.Add(this.uiTextBox4); this.PagePanel.Controls.Add(this.uiLine3); this.PagePanel.Controls.Add(this.uiLine2); + this.PagePanel.Controls.Add(this.uiRichTextBox1); + this.PagePanel.Controls.Add(this.uiLine5); + this.PagePanel.Controls.Add(this.uiLine4); this.PagePanel.Controls.Add(this.uiLine1); this.PagePanel.Controls.Add(this.uiDoubleUpDown1); - this.PagePanel.Controls.Add(this.uiDatePicker1); - this.PagePanel.Controls.Add(this.uiComboBox2); - this.PagePanel.Controls.Add(this.uiComboBox1); this.PagePanel.Controls.Add(this.uiLabel3); this.PagePanel.Controls.Add(this.uiTextBox3); this.PagePanel.Controls.Add(this.uiLabel2); @@ -101,6 +85,8 @@ this.uiTextBox1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiTextBox1.Location = new System.Drawing.Point(117, 54); this.uiTextBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.uiTextBox1.Maximum = 2147483647D; + this.uiTextBox1.Minimum = -2147483648D; this.uiTextBox1.Name = "uiTextBox1"; this.uiTextBox1.Padding = new System.Windows.Forms.Padding(5); this.uiTextBox1.Size = new System.Drawing.Size(221, 29); @@ -169,6 +155,8 @@ this.uiTextBox3.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiTextBox3.Location = new System.Drawing.Point(117, 132); this.uiTextBox3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.uiTextBox3.Maximum = 2147483647D; + this.uiTextBox3.Minimum = -2147483648D; this.uiTextBox3.Name = "uiTextBox3"; this.uiTextBox3.Padding = new System.Windows.Forms.Padding(5); this.uiTextBox3.Size = new System.Drawing.Size(221, 29); @@ -176,66 +164,6 @@ this.uiTextBox3.Type = Sunny.UI.UITextBox.UIEditType.Double; this.uiTextBox3.Watermark = "水印文字"; // - // uiComboBox1 - // - this.uiComboBox1.FillColor = System.Drawing.Color.White; - this.uiComboBox1.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiComboBox1.Items.AddRange(new object[] { - "1", - "2", - "3", - "4", - "5", - "6"}); - this.uiComboBox1.Location = new System.Drawing.Point(30, 212); - this.uiComboBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiComboBox1.MinimumSize = new System.Drawing.Size(63, 0); - this.uiComboBox1.Name = "uiComboBox1"; - this.uiComboBox1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); - this.uiComboBox1.Size = new System.Drawing.Size(150, 29); - this.uiComboBox1.TabIndex = 11; - this.uiComboBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; - this.uiComboBox1.Watermark = "水印文字"; - // - // uiComboBox2 - // - this.uiComboBox2.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; - this.uiComboBox2.FillColor = System.Drawing.Color.White; - this.uiComboBox2.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiComboBox2.Items.AddRange(new object[] { - "1", - "2", - "3", - "4", - "5", - "6"}); - this.uiComboBox2.Location = new System.Drawing.Point(188, 212); - this.uiComboBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiComboBox2.MinimumSize = new System.Drawing.Size(63, 0); - this.uiComboBox2.Name = "uiComboBox2"; - this.uiComboBox2.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); - this.uiComboBox2.Size = new System.Drawing.Size(150, 29); - this.uiComboBox2.TabIndex = 12; - this.uiComboBox2.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; - // - // uiDatePicker1 - // - this.uiDatePicker1.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; - this.uiDatePicker1.FillColor = System.Drawing.Color.White; - this.uiDatePicker1.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiDatePicker1.Location = new System.Drawing.Point(30, 294); - this.uiDatePicker1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiDatePicker1.MinimumSize = new System.Drawing.Size(63, 0); - this.uiDatePicker1.Name = "uiDatePicker1"; - this.uiDatePicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); - this.uiDatePicker1.Size = new System.Drawing.Size(150, 29); - this.uiDatePicker1.SymbolDropDown = 61555; - this.uiDatePicker1.SymbolNormal = 61555; - this.uiDatePicker1.TabIndex = 13; - this.uiDatePicker1.Text = "2020-04-16"; - this.uiDatePicker1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; - this.uiDatePicker1.Value = new System.DateTime(2020, 4, 16, 0, 0, 0, 0); - // // uiDoubleUpDown1 // this.uiDoubleUpDown1.Font = new System.Drawing.Font("微软雅黑", 12F); @@ -259,28 +187,6 @@ this.uiLine1.Text = "UITextBox"; this.uiLine1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // uiLine2 - // - this.uiLine2.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiLine2.Location = new System.Drawing.Point(30, 178); - this.uiLine2.MinimumSize = new System.Drawing.Size(16, 16); - this.uiLine2.Name = "uiLine2"; - this.uiLine2.Size = new System.Drawing.Size(308, 20); - this.uiLine2.TabIndex = 21; - this.uiLine2.Text = "UICombobox"; - this.uiLine2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // uiLine3 - // - this.uiLine3.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiLine3.Location = new System.Drawing.Point(30, 260); - this.uiLine3.MinimumSize = new System.Drawing.Size(16, 16); - this.uiLine3.Name = "uiLine3"; - this.uiLine3.Size = new System.Drawing.Size(150, 20); - this.uiLine3.TabIndex = 22; - this.uiLine3.Text = "UIDatePicker"; - this.uiLine3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // uiLine4 // this.uiLine4.Font = new System.Drawing.Font("微软雅黑", 12F); @@ -303,102 +209,63 @@ this.uiLine5.Text = "UIDoubleUpDown"; this.uiLine5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // uiTimePicker1 + // uiRichTextBox1 // - this.uiTimePicker1.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; - this.uiTimePicker1.FillColor = System.Drawing.Color.White; - this.uiTimePicker1.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiTimePicker1.Location = new System.Drawing.Point(188, 294); - this.uiTimePicker1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiTimePicker1.MinimumSize = new System.Drawing.Size(63, 0); - this.uiTimePicker1.Name = "uiTimePicker1"; - this.uiTimePicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); - this.uiTimePicker1.Size = new System.Drawing.Size(150, 29); - this.uiTimePicker1.SymbolDropDown = 61555; - this.uiTimePicker1.SymbolNormal = 61555; - this.uiTimePicker1.TabIndex = 25; - this.uiTimePicker1.Text = "23:41:39"; - this.uiTimePicker1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; - this.uiTimePicker1.Value = new System.DateTime(2020, 5, 29, 23, 41, 39, 684); + this.uiRichTextBox1.AutoWordSelection = true; + this.uiRichTextBox1.FillColor = System.Drawing.Color.White; + this.uiRichTextBox1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiRichTextBox1.Location = new System.Drawing.Point(388, 219); + this.uiRichTextBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.uiRichTextBox1.Name = "uiRichTextBox1"; + this.uiRichTextBox1.Padding = new System.Windows.Forms.Padding(2); + this.uiRichTextBox1.Size = new System.Drawing.Size(308, 226); + this.uiRichTextBox1.Style = Sunny.UI.UIStyle.Custom; + this.uiRichTextBox1.TabIndex = 32; + this.uiRichTextBox1.Text = "Blog: https://www.cnblogs.com/yhuse\nGitee: https://gitee.com/yhuse/SunnyUI\nGitHub" + + ": https://github.com/yhuse/SunnyUI\nSunnyUI.Net 系列文章目录\n欢迎交流,QQ群: 56829229 (SunnyU" + + "I技术交流群),请给源码项目点个Star吧!!!"; // - // uiLine6 + // uiLine2 // - this.uiLine6.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiLine6.Location = new System.Drawing.Point(188, 260); - this.uiLine6.MinimumSize = new System.Drawing.Size(16, 16); - this.uiLine6.Name = "uiLine6"; - this.uiLine6.Size = new System.Drawing.Size(150, 20); - this.uiLine6.TabIndex = 26; - this.uiLine6.Text = "UITimePicker"; - this.uiLine6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.uiLine2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLine2.Location = new System.Drawing.Point(30, 180); + this.uiLine2.MinimumSize = new System.Drawing.Size(16, 16); + this.uiLine2.Name = "uiLine2"; + this.uiLine2.Size = new System.Drawing.Size(308, 20); + this.uiLine2.TabIndex = 33; + this.uiLine2.Text = "UITextBox"; + this.uiLine2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // uiLine7 + // uiLine3 // - this.uiLine7.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiLine7.Location = new System.Drawing.Point(30, 342); - this.uiLine7.MinimumSize = new System.Drawing.Size(16, 16); - this.uiLine7.Name = "uiLine7"; - this.uiLine7.Size = new System.Drawing.Size(150, 20); - this.uiLine7.TabIndex = 28; - this.uiLine7.Text = "UIColorPicker"; - this.uiLine7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.uiLine3.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLine3.Location = new System.Drawing.Point(388, 180); + this.uiLine3.MinimumSize = new System.Drawing.Size(16, 16); + this.uiLine3.Name = "uiLine3"; + this.uiLine3.Size = new System.Drawing.Size(308, 20); + this.uiLine3.TabIndex = 34; + this.uiLine3.Text = "UIRichTextBox"; + this.uiLine3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // uiColorPicker1 + // uiTextBox4 // - this.uiColorPicker1.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; - this.uiColorPicker1.FillColor = System.Drawing.Color.White; - this.uiColorPicker1.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiColorPicker1.Location = new System.Drawing.Point(30, 376); - this.uiColorPicker1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiColorPicker1.MinimumSize = new System.Drawing.Size(63, 0); - this.uiColorPicker1.Name = "uiColorPicker1"; - this.uiColorPicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); - this.uiColorPicker1.Size = new System.Drawing.Size(150, 29); - this.uiColorPicker1.TabIndex = 29; - this.uiColorPicker1.Text = "uiColorPicker1"; - this.uiColorPicker1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; - this.uiColorPicker1.Value = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(159)))), ((int)(((byte)(254))))); - // - // uiDatetimePicker1 - // - this.uiDatetimePicker1.FillColor = System.Drawing.Color.White; - this.uiDatetimePicker1.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiDatetimePicker1.Location = new System.Drawing.Point(388, 294); - this.uiDatetimePicker1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiDatetimePicker1.MinimumSize = new System.Drawing.Size(63, 0); - this.uiDatetimePicker1.Name = "uiDatetimePicker1"; - this.uiDatetimePicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); - this.uiDatetimePicker1.Size = new System.Drawing.Size(306, 29); - this.uiDatetimePicker1.TabIndex = 30; - this.uiDatetimePicker1.Text = "2020-06-02 17:57:28"; - this.uiDatetimePicker1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; - this.uiDatetimePicker1.Value = new System.DateTime(2020, 6, 2, 17, 57, 28, 203); - // - // uiLine8 - // - this.uiLine8.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiLine8.Location = new System.Drawing.Point(388, 260); - this.uiLine8.MinimumSize = new System.Drawing.Size(16, 16); - this.uiLine8.Name = "uiLine8"; - this.uiLine8.Size = new System.Drawing.Size(306, 20); - this.uiLine8.TabIndex = 31; - this.uiLine8.Text = "UIDatetimePicker"; - this.uiLine8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // uiDatetimePicker2 - // - this.uiDatetimePicker2.FillColor = System.Drawing.Color.White; - this.uiDatetimePicker2.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiDatetimePicker2.Location = new System.Drawing.Point(355, 361); - this.uiDatetimePicker2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiDatetimePicker2.MinimumSize = new System.Drawing.Size(63, 0); - this.uiDatetimePicker2.Name = "uiDatetimePicker2"; - this.uiDatetimePicker2.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); - this.uiDatetimePicker2.Size = new System.Drawing.Size(249, 29); - this.uiDatetimePicker2.TabIndex = 32; - this.uiDatetimePicker2.Text = "uiDatetimePicker2"; - this.uiDatetimePicker2.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; - this.uiDatetimePicker2.Value = new System.DateTime(2020, 6, 4, 21, 41, 10, 904); + this.uiTextBox4.Cursor = System.Windows.Forms.Cursors.IBeam; + this.uiTextBox4.FillColor = System.Drawing.Color.White; + this.uiTextBox4.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiTextBox4.Location = new System.Drawing.Point(30, 219); + this.uiTextBox4.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.uiTextBox4.Maximum = 2147483647D; + this.uiTextBox4.Minimum = -2147483648D; + this.uiTextBox4.Multiline = true; + this.uiTextBox4.Name = "uiTextBox4"; + this.uiTextBox4.Padding = new System.Windows.Forms.Padding(5); + this.uiTextBox4.Size = new System.Drawing.Size(308, 226); + this.uiTextBox4.Style = Sunny.UI.UIStyle.Custom; + this.uiTextBox4.TabIndex = 35; + this.uiTextBox4.Text = "Blog: https://www.cnblogs.com/yhuse\r\nGitee: https://gitee.com/yhuse/SunnyUI\r\nGitH" + + "ub: https://github.com/yhuse/SunnyUI\r\nSunnyUI.Net 系列文章目录\r\n欢迎交流,QQ群: 56829229 (Su" + + "nnyUI技术交流群),请给源码项目点个Star吧!!!"; + this.uiTextBox4.Watermark = "水印文字"; // // FTextBox // @@ -422,21 +289,13 @@ private UILabel uiLabel1; private UITextBox uiTextBox1; private UIIntegerUpDown uiIntegerUpDown1; - private UIDatePicker uiDatePicker1; - private UIComboBox uiComboBox2; - private UIComboBox uiComboBox1; private UIDoubleUpDown uiDoubleUpDown1; private UILine uiLine4; - private UILine uiLine3; - private UILine uiLine2; private UILine uiLine1; private UILine uiLine5; - private UITimePicker uiTimePicker1; - private UILine uiLine6; - private UILine uiLine7; - private UIColorPicker uiColorPicker1; - private UILine uiLine8; - private UIDatetimePicker uiDatetimePicker1; - private UIDatetimePicker uiDatetimePicker2; + private UIRichTextBox uiRichTextBox1; + private UITextBox uiTextBox4; + private UILine uiLine3; + private UILine uiLine2; } } \ No newline at end of file diff --git a/SunnyUI.Demo/Controls/FTextBox.cs b/SunnyUI.Demo/Controls/FTextBox.cs index ea3b458d..1029db54 100644 --- a/SunnyUI.Demo/Controls/FTextBox.cs +++ b/SunnyUI.Demo/Controls/FTextBox.cs @@ -1,16 +1,10 @@ -using System; - -namespace Sunny.UI.Demo +namespace Sunny.UI.Demo { public partial class FTextBox : UITitlePage { public FTextBox() { InitializeComponent(); - - uiDatePicker1.Value = DateTime.Today; - uiTimePicker1.Value = DateTime.Now; - uiDatetimePicker1.Value = DateTime.Now; } } } \ No newline at end of file diff --git a/SunnyUI.Demo/FMain.cs b/SunnyUI.Demo/FMain.cs index ed0fcc30..b54092e6 100644 --- a/SunnyUI.Demo/FMain.cs +++ b/SunnyUI.Demo/FMain.cs @@ -18,6 +18,7 @@ namespace Sunny.UI.Demo Aside.CreateChildNode(parent, 61770, 24, AddPage(new FCheckBox(), ++pageIndex)); Aside.CreateChildNode(parent, 61842, 24, AddPage(new FRadioButton(), ++pageIndex)); Aside.CreateChildNode(parent, 61962, 24, AddPage(new FTextBox(), ++pageIndex)); + Aside.CreateChildNode(parent, 61776, 24, AddPage(new FCombobox(), ++pageIndex)); Aside.CreateChildNode(parent, 61646, 24, AddPage(new FDataGridView(), ++pageIndex)); Aside.CreateChildNode(parent, 61474, 24, AddPage(new FListBox(), ++pageIndex)); Aside.CreateChildNode(parent, 61499, 24, AddPage(new FTreeView(), ++pageIndex)); diff --git a/SunnyUI.Demo/SunnyUI.Demo.csproj b/SunnyUI.Demo/SunnyUI.Demo.csproj index ba702aa7..b37e9206 100644 --- a/SunnyUI.Demo/SunnyUI.Demo.csproj +++ b/SunnyUI.Demo/SunnyUI.Demo.csproj @@ -105,6 +105,12 @@ FContextMenuStrip.cs + + Form + + + FCombobox.cs + Form @@ -266,6 +272,9 @@ FCheckBox.cs + + FCombobox.cs + FMeter.cs diff --git a/SunnyUI/Controls/UIDateTimePicker.cs b/SunnyUI/Controls/UIDateTimePicker.cs index 1b3bd594..2587ffad 100644 --- a/SunnyUI/Controls/UIDateTimePicker.cs +++ b/SunnyUI/Controls/UIDateTimePicker.cs @@ -18,6 +18,8 @@ namespace Sunny.UI this.ButtonClick += new System.EventHandler(this.UIDatetimePicker_ButtonClick); this.ResumeLayout(false); this.PerformLayout(); + + DropDownStyle = UIDropDownStyle.DropDownList; } public UIDatetimePicker() diff --git a/SunnyUI/Controls/UIEdit.cs b/SunnyUI/Controls/UIEdit.cs index e32b9657..dcd09c4f 100644 --- a/SunnyUI/Controls/UIEdit.cs +++ b/SunnyUI/Controls/UIEdit.cs @@ -34,8 +34,8 @@ namespace Sunny.UI private bool hasMaxValue; private bool hasMinValue; private string mask = "0.00"; - private double maxValue = double.MaxValue; - private double minValue = double.MinValue; + private double maxValue = int.MaxValue; + private double minValue = int.MinValue; private UITextBox.UIEditType _uiEditType = UITextBox.UIEditType.String; public UIEdit() @@ -45,7 +45,7 @@ namespace Sunny.UI Font = UIFontColor.Font; ForeColor = UIFontColor.Primary; Width = 150; - MaxLength = 255; + MaxLength = 32767; } private string watermark; diff --git a/SunnyUI/Controls/UIRichTextBox.cs b/SunnyUI/Controls/UIRichTextBox.cs new file mode 100644 index 00000000..10b6d809 --- /dev/null +++ b/SunnyUI/Controls/UIRichTextBox.cs @@ -0,0 +1,773 @@ +using System; +using System.ComponentModel; +using System.Drawing; +using System.Drawing.Design; +using System.IO; +using System.Windows.Forms; + +namespace Sunny.UI +{ + [DefaultEvent("TextChanged")] + [DefaultProperty("Text")] + public sealed class UIRichTextBox : UIPanel + { + private UIScrollBar bar; + private RichTextBox edit; + + public UIRichTextBox() + { + InitializeComponent(); + + ShowText = false; + + edit.MouseWheel += OnMouseWheel; + edit.TextChanged += Edit_TextChanged; + edit.KeyDown += EditOnKeyDown; + edit.KeyUp += EditOnKeyUp; + edit.KeyPress += EditOnKeyPress; + + bar.Parent = this; + bar.Style = UIStyle.Custom; + bar.Visible = false; + bar.ValueChanged += Bar_ValueChanged; + bar.MouseEnter += Bar_MouseEnter; + SizeChange(); + + edit.DragDrop += Edit_DragDrop; + edit.DragEnter += Edit_DragEnter; + edit.DragLeave += Edit_DragLeave; + edit.DragOver += Edit_DragOver; + edit.GiveFeedback += Edit_GiveFeedback; + edit.QueryContinueDrag += Edit_QueryContinueDrag; + edit.LinkClicked += Edit_LinkClicked; + edit.Protected += Edit_Protected; + edit.SelectionChanged += Edit_SelectionChanged; + + edit.ScrollBars = RichTextBoxScrollBars.Vertical; + } + + private bool showScrollBar = true; + + // [DefaultValue(true)] + // public bool ShowScrollBar + // { + // get => showScrollBar; + // set + // { + // showScrollBar = value; + // bar.Visible = value; + // edit.ScrollBars = value ? RichTextBoxScrollBars.Vertical : RichTextBoxScrollBars.None; + // SetScrollInfo(); + // } + // } + + private void Edit_SelectionChanged(object sender, EventArgs e) + { + SelectionChanged?.Invoke(sender, e); + } + + private void Edit_Protected(object sender, EventArgs e) + { + Protected?.Invoke(sender, e); + } + + private void Edit_LinkClicked(object sender, LinkClickedEventArgs e) + { + LinkClicked?.Invoke(sender, e); + } + + private void Edit_QueryContinueDrag(object sender, QueryContinueDragEventArgs e) + { + QueryContinueDrag?.Invoke(sender, e); + } + + private void Edit_GiveFeedback(object sender, GiveFeedbackEventArgs e) + { + GiveFeedback?.Invoke(sender, e); + } + + private void Edit_DragOver(object sender, DragEventArgs e) + { + DragOver?.Invoke(sender, e); + } + + private void Edit_DragLeave(object sender, EventArgs e) + { + DragLeave?.Invoke(sender, e); + } + + private void Edit_DragEnter(object sender, DragEventArgs e) + { + DragEnter?.Invoke(sender, e); + } + + private void Edit_DragDrop(object sender, DragEventArgs e) + { + DragDrop?.Invoke(sender, e); + } + + public new event KeyEventHandler KeyDown; + + public new event KeyEventHandler KeyUp; + + public new event KeyPressEventHandler KeyPress; + + protected override void OnGotFocus(EventArgs e) + { + base.OnGotFocus(e); + edit.Focus(); + } + + protected override void OnMouseDown(MouseEventArgs e) + { + ActiveControl = edit; + } + + public override void SetStyleColor(UIBaseStyle uiColor) + { + base.SetStyleColor(uiColor); + if (uiColor.IsCustom()) return; + + edit.BackColor = fillColor = Color.White; + edit.ForeColor = foreColor = UIFontColor.Primary; + + if (bar != null) + { + bar.ForeColor = uiColor.PrimaryColor; + bar.HoverColor = uiColor.ButtonFillHoverColor; + bar.PressColor = uiColor.ButtonFillPressColor; + bar.FillColor = Color.White; + } + + Invalidate(); + } + + protected override void AfterSetForeColor(Color color) + { + base.AfterSetForeColor(color); + edit.ForeColor = color; + } + + protected override void AfterSetFillColor(Color color) + { + base.AfterSetFillColor(color); + edit.BackColor = color; + } + + private void EditOnKeyPress(object sender, KeyPressEventArgs e) + { + KeyPress?.Invoke(sender, e); + } + + private void EditOnKeyDown(object sender, KeyEventArgs e) + { + KeyDown?.Invoke(sender, e); + } + + private void EditOnKeyUp(object sender, KeyEventArgs e) + { + KeyUp?.Invoke(sender, e); + } + + [CategoryAttribute("文字"), Browsable(true)] + [DefaultValue("")] + public override string Text + { + get => edit.Text; + set => edit.Text = value; + } + + [Browsable(true)] + public new event EventHandler TextChanged; + + private void Edit_TextChanged(object sender, EventArgs e) + { + TextChanged?.Invoke(this, e); + SetScrollInfo(); + } + + private void Bar_MouseEnter(object sender, EventArgs e) + { + Cursor = Cursors.Default; + } + + private void Bar_ValueChanged(object sender, EventArgs e) + { + if (edit != null) + { + ScrollBarInfo.SetScrollValue(edit.Handle, bar.Value); + } + } + + private void OnMouseWheel(object sender, MouseEventArgs e) + { + base.OnMouseWheel(e); + if (bar.Visible) + { + var si = ScrollBarInfo.GetInfo(Handle); + if (e.Delta > 10) + { + if (si.nPos > 0) + { + ScrollBarInfo.ScrollUp(Handle); + } + } + else if (e.Delta < -10) + { + if (si.nPos < si.ScrollMax) + { + ScrollBarInfo.ScrollDown(Handle); + } + } + } + + SetScrollInfo(); + } + + public void SetScrollInfo() + { + if (bar == null) + { + return; + } + + var si = ScrollBarInfo.GetInfo(edit.Handle); + if (si.ScrollMax > 0) + { + bar.Maximum = si.ScrollMax; + bar.Visible = showScrollBar && (si.ScrollMax > 0 && si.nMax > 0 && si.nPage > 0); + bar.Value = si.nPos; + } + else + { + bar.Visible = false; + } + } + + private void SizeChange() + { + bar.Top = 2; + bar.Width = ScrollBarInfo.VerticalScrollBarWidth(); + bar.Left = Width - bar.Width - 1; + bar.Height = Height - 4; + bar.BringToFront(); + SetScrollInfo(); + } + + private void InitializeComponent() + { + this.edit = new System.Windows.Forms.RichTextBox(); + this.bar = new Sunny.UI.UIScrollBar(); + this.SuspendLayout(); + // + // edit + // + this.edit.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.edit.Dock = System.Windows.Forms.DockStyle.Fill; + this.edit.Location = new System.Drawing.Point(2, 2); + this.edit.Name = "edit"; + this.edit.Size = new System.Drawing.Size(266, 176); + this.edit.TabIndex = 0; + this.edit.Text = ""; + // + // bar + // + this.bar.Font = new System.Drawing.Font("微软雅黑", 12F); + this.bar.Location = new System.Drawing.Point(247, 4); + this.bar.Name = "bar"; + this.bar.Size = new System.Drawing.Size(19, 173); + this.bar.Style = Sunny.UI.UIStyle.Custom; + this.bar.TabIndex = 2; + this.bar.Text = "uiScrollBar1"; + // + // UIRichTextBox + // + this.Controls.Add(this.bar); + this.Controls.Add(this.edit); + this.FillColor = System.Drawing.Color.White; + this.Name = "UIRichTextBox"; + this.Padding = new System.Windows.Forms.Padding(2); + this.Style = Sunny.UI.UIStyle.Custom; + this.FontChanged += new System.EventHandler(this.UIRichTextBox_FontChanged); + this.SizeChanged += new System.EventHandler(this.UIRichTextBox_SizeChanged); + this.ResumeLayout(false); + } + + private void UIRichTextBox_SizeChanged(object sender, EventArgs e) + { + SizeChange(); + } + + private void UIRichTextBox_FontChanged(object sender, EventArgs e) + { + edit.Font = Font; + } + + #region TextBoxBase + + [DefaultValue(false)] + public bool AcceptsTab + { + get => edit.AcceptsTab; + set => edit.AcceptsTab = value; + } + + [DefaultValue(true)] + public bool ShortcutsEnabled + { + get => edit.ShortcutsEnabled; + set => edit.ShortcutsEnabled = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool CanUndo + { + get => edit.CanUndo; + } + + [DefaultValue(true)] + public bool HideSelection + { + get => edit.HideSelection; + set => edit.HideSelection = value; + } + + [ + DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), + MergableProperty(false), + Localizable(true), + Editor("System.Windows.Forms.Design.StringArrayEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor)) + ] + public string[] Lines + { + get => edit.Lines; + set => edit.Lines = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool Modified + { + get => edit.Modified; + set => edit.Modified = value; + } + + [ + Browsable(false), EditorBrowsable(EditorBrowsableState.Advanced), + DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) + ] + public int PreferredHeight + { + get => edit.PreferredHeight; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public string SelectedText + { + get => edit.SelectedText; + set => edit.SelectedText = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int SelectionLength + { + get => edit.SelectionLength; + set => edit.SelectionLength = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int SelectionStart + { + get => edit.SelectionStart; + set => edit.SelectionStart = value; + } + + [Browsable(false)] + public int TextLength + { + get => edit.TextLength; + } + + public void AppendText(string text) + { + edit.AppendText(text); + } + + public void ClearUndo() + { + edit.ClearUndo(); + } + + public void Copy() + { + edit.Copy(); + } + + public void Cut() + { + edit.Cut(); + } + + public void Paste() + { + edit.Paste(); + } + + public char GetCharFromPosition(Point pt) + { + return edit.GetCharFromPosition(pt); + } + + public int GetCharIndexFromPosition(Point pt) + { + return edit.GetCharIndexFromPosition(pt); + } + + public int GetLineFromCharIndex(int index) + { + return edit.GetLineFromCharIndex(index); + } + + public Point GetPositionFromCharIndex(int index) + { + return edit.GetPositionFromCharIndex(index); + } + + public int GetFirstCharIndexFromLine(int lineNumber) + { + return edit.GetFirstCharIndexFromLine(lineNumber); + } + + public int GetFirstCharIndexOfCurrentLine() + { + return edit.GetFirstCharIndexOfCurrentLine(); + } + + public void DeselectAll() + { + edit.DeselectAll(); + } + + public void Undo() + { + edit.Undo(); + } + + #endregion TextBoxBase + + #region RichTextBox + + [Browsable(false)] + public override bool AllowDrop + { + get => edit.AllowDrop; + set => edit.AllowDrop = value; + } + + [DefaultValue(false)] + public bool AutoWordSelection + { + get => edit.AllowDrop; + set => edit.AllowDrop = value; + } + + [DefaultValue(0), Localizable(true)] + public int BulletIndent + { + get => edit.BulletIndent; + set => edit.BulletIndent = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool CanRedo + { + get => edit.CanRedo; + } + + [DefaultValue(true)] + public bool DetectUrls + { + get => edit.DetectUrls; + set => edit.DetectUrls = value; + } + + [DefaultValue(false)] + public bool EnableAutoDragDrop + { + get => edit.EnableAutoDragDrop; + set => edit.EnableAutoDragDrop = value; + } + + [ + Browsable(false), + DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) + ] + public RichTextBoxLanguageOptions LanguageOption + { + get => edit.LanguageOption; + set => edit.LanguageOption = value; + } + + [DefaultValue(int.MaxValue)] + public int MaxLength + { + get => edit.MaxLength; + set => edit.MaxLength = value; + } + + [DefaultValue(true)] + public bool Multiline + { + get => edit.Multiline; + set => edit.Multiline = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public string RedoActionName + { + get => edit.RedoActionName; + } + + [DefaultValue(true), Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public bool RichTextShortcutsEnabled + { + get => edit.RichTextShortcutsEnabled; + set => edit.RichTextShortcutsEnabled = value; + } + + [DefaultValue(0), Localizable(true)] + public int RightMargin + { + get => edit.RightMargin; + set => edit.RightMargin = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), RefreshProperties(RefreshProperties.All)] + public string Rtf + { + get => edit.Rtf; + set => edit.Rtf = value; + } + + [DefaultValue(HorizontalAlignment.Left), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public HorizontalAlignment SelectionAlignment + { + get => edit.SelectionAlignment; + set => edit.SelectionAlignment = value; + } + + [DefaultValue(false), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool SelectionBullet + { + get => edit.SelectionBullet; + set => edit.SelectionBullet = value; + } + + [DefaultValue(0), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int SelectionCharOffset + { + get => edit.SelectionCharOffset; + set => edit.SelectionCharOffset = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public Color SelectionColor + { + get => edit.SelectionColor; + set => edit.SelectionColor = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public Color SelectionBackColor + { + get => edit.SelectionBackColor; + set => edit.SelectionBackColor = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public Font SelectionFont + { + get => edit.SelectionFont; + set => edit.SelectionFont = value; + } + + [DefaultValue(0), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int SelectionHangingIndent + { + get => edit.SelectionHangingIndent; + set => edit.SelectionHangingIndent = value; + } + + [DefaultValue(0), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int SelectionIndent + { + get => edit.SelectionIndent; + set => edit.SelectionIndent = value; + } + + [DefaultValue(false), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool SelectionProtected + { + get => edit.SelectionProtected; + set => edit.SelectionProtected = value; + } + + [DefaultValue(""), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public string SelectedRtf + { + get => edit.SelectedRtf; + set => edit.SelectedRtf = value; + } + + [DefaultValue(0), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int SelectionRightIndent + { + get => edit.SelectionRightIndent; + set => edit.SelectionRightIndent = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int[] SelectionTabs + { + get => edit.SelectionTabs; + set => edit.SelectionTabs = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public RichTextBoxSelectionTypes SelectionType + { + get => edit.SelectionType; + } + + [DefaultValue(false)] + public bool ShowSelectionMargin + { + get => edit.ShowSelectionMargin; + set => edit.ShowSelectionMargin = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public string UndoActionName + { + get => edit.UndoActionName; + } + + [DefaultValue(1.0f), Localizable(true)] + public float ZoomFactor + { + get => edit.ZoomFactor; + set => edit.ZoomFactor = value; + } + + public bool CanPaste(DataFormats.Format clipFormat) + { + return edit.CanPaste(clipFormat); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public new void DrawToBitmap(Bitmap bitmap, Rectangle targetBounds) + { + edit.DrawToBitmap(bitmap, targetBounds); + } + + public int Find(string str) + { + return edit.Find(str); + } + + public int Find(string str, RichTextBoxFinds options) + { + return edit.Find(str, options); + } + + public int Find(string str, int start, RichTextBoxFinds options) + { + return edit.Find(str, start, options); + } + + public int Find(string str, int start, int end, RichTextBoxFinds options) + { + return edit.Find(str, start, end, options); + } + + public int Find(char[] characterSet) + { + return edit.Find(characterSet); + } + + public int Find(char[] characterSet, int start) + { + return edit.Find(characterSet, start); + } + + public int Find(char[] characterSet, int start, int end) + { + return edit.Find(characterSet, start, end); + } + + public void LoadFile(string path) + { + edit.LoadFile(path); + } + + public void LoadFile(string path, RichTextBoxStreamType fileType) + { + edit.LoadFile(path, fileType); + } + + public void LoadFile(Stream data, RichTextBoxStreamType fileType) + { + edit.LoadFile(data, fileType); + } + + public void Paste(DataFormats.Format clipFormat) + { + edit.Paste(clipFormat); + } + + public void Redo() + { + edit.Redo(); + } + + public void SaveFile(string path) + { + edit.SaveFile(path); + } + + public void SaveFile(string path, RichTextBoxStreamType fileType) + { + edit.SaveFile(path, fileType); + } + + public void SaveFile(Stream data, RichTextBoxStreamType fileType) + { + edit.SaveFile(data, fileType); + } + + [Browsable(false)] + public new event DragEventHandler DragDrop; + + [Browsable(false)] + public new event DragEventHandler DragEnter; + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new event EventHandler DragLeave; + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new event DragEventHandler DragOver; + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new event GiveFeedbackEventHandler GiveFeedback; + + [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] + public new event QueryContinueDragEventHandler QueryContinueDrag; + + public event LinkClickedEventHandler LinkClicked; + + public event EventHandler Protected; + + public event EventHandler SelectionChanged; + + #endregion RichTextBox + } +} \ No newline at end of file diff --git a/SunnyUI/Controls/UITextBox.cs b/SunnyUI/Controls/UITextBox.cs index e54d7259..c2e40889 100644 --- a/SunnyUI/Controls/UITextBox.cs +++ b/SunnyUI/Controls/UITextBox.cs @@ -21,8 +21,10 @@ ******************************************************************************/ using System; +using System.Collections; using System.ComponentModel; using System.Drawing; +using System.Drawing.Design; using System.Drawing.Drawing2D; using System.Windows.Forms; @@ -39,14 +41,15 @@ namespace Sunny.UI { InitializeComponent(); + ShowText = false; Font = UIFontColor.Font; edit.Left = 3; edit.Top = 3; edit.Text = String.Empty; edit.BorderStyle = BorderStyle.None; - edit.KeyDown += EditOnKeyDown; edit.TextChanged += EditTextChanged; + edit.KeyDown += EditOnKeyDown; edit.KeyUp += EditOnKeyUp; edit.KeyPress += EditOnKeyPress; edit.MouseEnter += Edit_MouseEnter; @@ -148,6 +151,11 @@ namespace Sunny.UI KeyPress?.Invoke(sender, e); } + private void EditOnKeyDown(object sender, KeyEventArgs e) + { + KeyDown?.Invoke(sender, e); + } + private void EditOnKeyUp(object sender, KeyEventArgs e) { KeyUp?.Invoke(sender, e); @@ -261,29 +269,6 @@ namespace Sunny.UI } } - private void EditOnKeyDown(object sender, KeyEventArgs e) - { - KeyDown?.Invoke(sender, e); - - // if (e.Control && e.KeyCode == Keys.A) - // { - // edit.SelectAll(); - // e.SuppressKeyPress = true; - // } - // - // if (e.Control && e.KeyCode == Keys.C) - // { - // edit.Copy(); - // e.SuppressKeyPress = true; - // } - // - // if (e.Control && e.KeyCode == Keys.V) - // { - // edit.Paste(); - // e.SuppressKeyPress = true; - // } - } - protected override void OnGotFocus(EventArgs e) { base.OnGotFocus(e); @@ -325,7 +310,7 @@ namespace Sunny.UI /// 当InputType为数字类型时,能输入的最大值 /// [Description("当InputType为数字类型时,能输入的最大值。")] - [DefaultValue(double.MaxValue)] + [DefaultValue(int.MaxValue)] public double Maximum { get => edit.MaxValue; @@ -336,7 +321,7 @@ namespace Sunny.UI /// 当InputType为数字类型时,能输入的最小值 /// [Description("当InputType为数字类型时,能输入的最小值。")] - [DefaultValue(double.MinValue)] + [DefaultValue(int.MinValue)] public double Minimum { get => edit.MinValue; @@ -410,7 +395,7 @@ namespace Sunny.UI ActiveControl = edit; } - [DefaultValue(255)] + [DefaultValue(32767)] public int MaxLength { get => edit.MaxLength; @@ -465,5 +450,228 @@ namespace Sunny.UI /// Double } + + [DefaultValue(false)] + public bool AcceptsReturn + { + get => edit.AcceptsReturn; + set => edit.AcceptsReturn = value; + } + + [DefaultValue(AutoCompleteMode.None), Browsable(true), EditorBrowsable(EditorBrowsableState.Always)] + public AutoCompleteMode AutoCompleteMode + { + get => edit.AutoCompleteMode; + set => edit.AutoCompleteMode = value; + } + + [ + DefaultValue(AutoCompleteSource.None), + TypeConverterAttribute(typeof(TextBoxAutoCompleteSourceConverter)), + Browsable(true), + EditorBrowsable(EditorBrowsableState.Always) + ] + public AutoCompleteSource AutoCompleteSource + { + get => edit.AutoCompleteSource; + set => edit.AutoCompleteSource = value; + } + + [ + DesignerSerializationVisibility(DesignerSerializationVisibility.Content), + Localizable(true), + Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor)), + Browsable(true), + EditorBrowsable(EditorBrowsableState.Always) + ] + public AutoCompleteStringCollection AutoCompleteCustomSource + { + get => edit.AutoCompleteCustomSource; + set => edit.AutoCompleteCustomSource = value; + } + + [DefaultValue(CharacterCasing.Normal)] + public CharacterCasing CharacterCasing + { + get => edit.CharacterCasing; + set => edit.CharacterCasing = value; + } + + public void Paste(string text) + { + edit.Paste(text); + } + + + internal class TextBoxAutoCompleteSourceConverter : EnumConverter + { + public TextBoxAutoCompleteSourceConverter(Type type) : base(type) + { + } + + public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) + { + StandardValuesCollection values = base.GetStandardValues(context); + ArrayList list = new ArrayList(); + int count = values.Count; + for (int i = 0; i < count; i++) + { + string currentItemText = values[i].ToString(); + if (!currentItemText.Equals("ListItems")) + { + list.Add(values[i]); + } + } + + return new StandardValuesCollection(list); + } + } + + [DefaultValue(false)] + public bool AcceptsTab + { + get => edit.AcceptsTab; + set => edit.AcceptsTab = value; + } + + [DefaultValue(true)] + public bool ShortcutsEnabled + { + get => edit.ShortcutsEnabled; + set => edit.ShortcutsEnabled = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool CanUndo + { + get => edit.CanUndo; + } + + [DefaultValue(true)] + public bool HideSelection + { + get => edit.HideSelection; + set => edit.HideSelection = value; + } + + [ + DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), + MergableProperty(false), + Localizable(true), + Editor("System.Windows.Forms.Design.StringArrayEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor)) + ] + public string[] Lines + { + get => edit.Lines; + set => edit.Lines = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool Modified + { + get => edit.Modified; + set => edit.Modified = value; + } + + [ + Browsable(false), EditorBrowsable(EditorBrowsableState.Advanced), + DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) + ] + public int PreferredHeight + { + get => edit.PreferredHeight; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public string SelectedText + { + get => edit.SelectedText; + set => edit.SelectedText = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int SelectionLength + { + get => edit.SelectionLength; + set => edit.SelectionLength = value; + } + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int SelectionStart + { + get => edit.SelectionStart; + set => edit.SelectionStart = value; + } + + [Browsable(false)] + public int TextLength + { + get => edit.TextLength; + } + + public void AppendText(string text) + { + edit.AppendText(text); + } + + public void ClearUndo() + { + edit.ClearUndo(); + } + + public void Copy() + { + edit.Copy(); + } + + public void Cut() + { + edit.Cut(); + } + + public void Paste() + { + edit.Paste(); + } + + public char GetCharFromPosition(Point pt) + { + return edit.GetCharFromPosition(pt); + } + + public int GetCharIndexFromPosition(Point pt) + { + return edit.GetCharIndexFromPosition(pt); + } + + public int GetLineFromCharIndex(int index) + { + return edit.GetLineFromCharIndex(index); + } + + public Point GetPositionFromCharIndex(int index) + { + return edit.GetPositionFromCharIndex(index); + } + + public int GetFirstCharIndexFromLine(int lineNumber) + { + return edit.GetFirstCharIndexFromLine(lineNumber); + } + + public int GetFirstCharIndexOfCurrentLine() + { + return edit.GetFirstCharIndexOfCurrentLine(); + } + + public void DeselectAll() + { + edit.DeselectAll(); + } + + public void Undo() + { + edit.Undo(); + } } } \ No newline at end of file diff --git a/SunnyUI/SunnyUI.csproj b/SunnyUI/SunnyUI.csproj index b48aefe4..ef9950b7 100644 --- a/SunnyUI/SunnyUI.csproj +++ b/SunnyUI/SunnyUI.csproj @@ -97,6 +97,9 @@ UserControl + + UserControl + UserControl diff --git a/Updates.txt b/Updates.txt index ba57e171..dee4eadb 100644 --- a/Updates.txt +++ b/Updates.txt @@ -1,5 +1,9 @@ + ӣ - ɾ * ޸ +2020.06.04 ++ UIRichTextBox +* UITextBoxTextBoxĻͺ + 2020.06.04 + UIBattery * UITextBoxIntDoubleʱΪգĬֵɲΪ0