diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index 023b39ad..bd94f292 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb index eb755d92..5fe89c63 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 18e649a3..b6c69ac1 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 023b39ad..bd94f292 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.dll and b/SunnyUI.Demo/Bin/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Controls/FTextBox.Designer.cs b/SunnyUI.Demo/Controls/FTextBox.Designer.cs index 7a445f81..11c74047 100644 --- a/SunnyUI.Demo/Controls/FTextBox.Designer.cs +++ b/SunnyUI.Demo/Controls/FTextBox.Designer.cs @@ -91,7 +91,7 @@ this.uiTextBox1.Padding = new System.Windows.Forms.Padding(5); this.uiTextBox1.Size = new System.Drawing.Size(221, 29); this.uiTextBox1.TabIndex = 3; - this.uiTextBox1.Text = "uiTextBox1"; + this.uiTextBox1.Watermark = "水印文字"; // // uiLabel1 // @@ -175,6 +175,7 @@ this.uiComboBox1.Size = new System.Drawing.Size(150, 29); this.uiComboBox1.TabIndex = 11; this.uiComboBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + this.uiComboBox1.Watermark = "水印文字"; // // uiComboBox2 // @@ -209,6 +210,7 @@ this._uiDatePicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); this._uiDatePicker1.Size = new System.Drawing.Size(150, 29); 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); // diff --git a/SunnyUI.Demo/Forms/FDialogs.Designer.cs b/SunnyUI.Demo/Forms/FDialogs.Designer.cs index e34bc8ca..964cb659 100644 --- a/SunnyUI.Demo/Forms/FDialogs.Designer.cs +++ b/SunnyUI.Demo/Forms/FDialogs.Designer.cs @@ -49,11 +49,17 @@ this.uiSymbolButton4 = new Sunny.UI.UISymbolButton(); this.uiSymbolButton5 = new Sunny.UI.UISymbolButton(); this.uiSymbolButton6 = new Sunny.UI.UISymbolButton(); + this.uiLine6 = new Sunny.UI.UILine(); + this.btnEN = new Sunny.UI.UISymbolButton(); + this.btnCH = new Sunny.UI.UISymbolButton(); this.PagePanel.SuspendLayout(); this.SuspendLayout(); // // PagePanel // + this.PagePanel.Controls.Add(this.btnEN); + this.PagePanel.Controls.Add(this.btnCH); + this.PagePanel.Controls.Add(this.uiLine6); this.PagePanel.Controls.Add(this.uiLine5); this.PagePanel.Controls.Add(this.uiSymbolButton2); this.PagePanel.Controls.Add(this.uiSymbolButton4); @@ -281,7 +287,7 @@ this.uiLine3.Location = new System.Drawing.Point(30, 230); this.uiLine3.MinimumSize = new System.Drawing.Size(16, 16); this.uiLine3.Name = "uiLine3"; - this.uiLine3.Size = new System.Drawing.Size(670, 20); + this.uiLine3.Size = new System.Drawing.Size(328, 20); this.uiLine3.TabIndex = 49; this.uiLine3.Text = "UIStatusDialog"; this.uiLine3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -289,10 +295,10 @@ // uiLine4 // this.uiLine4.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiLine4.Location = new System.Drawing.Point(30, 314); + this.uiLine4.Location = new System.Drawing.Point(372, 230); this.uiLine4.MinimumSize = new System.Drawing.Size(16, 16); this.uiLine4.Name = "uiLine4"; - this.uiLine4.Size = new System.Drawing.Size(670, 20); + this.uiLine4.Size = new System.Drawing.Size(328, 20); this.uiLine4.TabIndex = 51; this.uiLine4.Text = "UISelectDialog"; this.uiLine4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -301,7 +307,7 @@ // this.uiSymbolButton1.Cursor = System.Windows.Forms.Cursors.Hand; this.uiSymbolButton1.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiSymbolButton1.Location = new System.Drawing.Point(30, 347); + this.uiSymbolButton1.Location = new System.Drawing.Point(372, 256); this.uiSymbolButton1.Name = "uiSymbolButton1"; this.uiSymbolButton1.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); this.uiSymbolButton1.Size = new System.Drawing.Size(214, 35); @@ -313,7 +319,7 @@ // uiLine5 // this.uiLine5.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiLine5.Location = new System.Drawing.Point(30, 397); + this.uiLine5.Location = new System.Drawing.Point(30, 312); this.uiLine5.MinimumSize = new System.Drawing.Size(16, 16); this.uiLine5.Name = "uiLine5"; this.uiLine5.Size = new System.Drawing.Size(670, 20); @@ -325,7 +331,7 @@ // this.uiSymbolButton2.Cursor = System.Windows.Forms.Cursors.Hand; this.uiSymbolButton2.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiSymbolButton2.Location = new System.Drawing.Point(30, 430); + this.uiSymbolButton2.Location = new System.Drawing.Point(30, 345); this.uiSymbolButton2.Name = "uiSymbolButton2"; this.uiSymbolButton2.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); this.uiSymbolButton2.Size = new System.Drawing.Size(100, 35); @@ -342,7 +348,7 @@ this.uiSymbolButton4.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(127)))), ((int)(((byte)(128))))); this.uiSymbolButton4.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89))))); this.uiSymbolButton4.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiSymbolButton4.Location = new System.Drawing.Point(372, 430); + this.uiSymbolButton4.Location = new System.Drawing.Point(372, 345); this.uiSymbolButton4.Name = "uiSymbolButton4"; this.uiSymbolButton4.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); this.uiSymbolButton4.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); @@ -363,7 +369,7 @@ this.uiSymbolButton5.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(174)))), ((int)(((byte)(86))))); this.uiSymbolButton5.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(137)))), ((int)(((byte)(43))))); this.uiSymbolButton5.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiSymbolButton5.Location = new System.Drawing.Point(258, 430); + this.uiSymbolButton5.Location = new System.Drawing.Point(258, 345); this.uiSymbolButton5.Name = "uiSymbolButton5"; this.uiSymbolButton5.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); this.uiSymbolButton5.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(155)))), ((int)(((byte)(40))))); @@ -384,7 +390,7 @@ this.uiSymbolButton6.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(136)))), ((int)(((byte)(202)))), ((int)(((byte)(81))))); this.uiSymbolButton6.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(168)))), ((int)(((byte)(35))))); this.uiSymbolButton6.Font = new System.Drawing.Font("微软雅黑", 12F); - this.uiSymbolButton6.Location = new System.Drawing.Point(144, 430); + this.uiSymbolButton6.Location = new System.Drawing.Point(144, 345); this.uiSymbolButton6.Name = "uiSymbolButton6"; this.uiSymbolButton6.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); this.uiSymbolButton6.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(190)))), ((int)(((byte)(40))))); @@ -398,6 +404,44 @@ this.uiSymbolButton6.Text = "Success"; this.uiSymbolButton6.Click += new System.EventHandler(this.uiSymbolButton6_Click); // + // uiLine6 + // + this.uiLine6.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLine6.Location = new System.Drawing.Point(30, 397); + this.uiLine6.MinimumSize = new System.Drawing.Size(16, 16); + this.uiLine6.Name = "uiLine6"; + this.uiLine6.Size = new System.Drawing.Size(670, 20); + this.uiLine6.TabIndex = 59; + this.uiLine6.Text = "ULocalize"; + this.uiLine6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // btnEN + // + this.btnEN.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnEN.Font = new System.Drawing.Font("微软雅黑", 12F); + this.btnEN.Location = new System.Drawing.Point(144, 432); + this.btnEN.Name = "btnEN"; + this.btnEN.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); + this.btnEN.Size = new System.Drawing.Size(100, 35); + this.btnEN.Symbol = 57571; + this.btnEN.TabIndex = 61; + this.btnEN.Text = "EN"; + this.btnEN.Click += new System.EventHandler(this.btnEN_Click); + // + // btnCH + // + this.btnCH.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnCH.Font = new System.Drawing.Font("微软雅黑", 12F); + this.btnCH.Location = new System.Drawing.Point(30, 432); + this.btnCH.Name = "btnCH"; + this.btnCH.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); + this.btnCH.Size = new System.Drawing.Size(100, 35); + this.btnCH.StyleCustomMode = true; + this.btnCH.Symbol = 57571; + this.btnCH.TabIndex = 60; + this.btnCH.Text = "CH"; + this.btnCH.Click += new System.EventHandler(this.btnCH_Click); + // // FDialogs // this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); @@ -434,5 +478,8 @@ private UISymbolButton uiSymbolButton4; private UISymbolButton uiSymbolButton5; private UISymbolButton uiSymbolButton6; + private UISymbolButton btnEN; + private UISymbolButton btnCH; + private UILine uiLine6; } } \ No newline at end of file diff --git a/SunnyUI.Demo/Forms/FDialogs.cs b/SunnyUI.Demo/Forms/FDialogs.cs index 92ac63a3..de30b9e3 100644 --- a/SunnyUI.Demo/Forms/FDialogs.cs +++ b/SunnyUI.Demo/Forms/FDialogs.cs @@ -122,5 +122,15 @@ namespace Sunny.UI.Demo { this.ShowErrorNotifier("Error"); } + + private void btnCH_Click(object sender, EventArgs e) + { + UILocalizeHelper.SetCH(); + } + + private void btnEN_Click(object sender, EventArgs e) + { + UILocalizeHelper.SetEN(); + } } } \ No newline at end of file diff --git a/SunnyUI/Controls/DropItem/UIDropControl.cs b/SunnyUI/Controls/DropItem/UIDropControl.cs index 512356d9..d9b71bb4 100644 --- a/SunnyUI/Controls/DropItem/UIDropControl.cs +++ b/SunnyUI/Controls/DropItem/UIDropControl.cs @@ -24,6 +24,7 @@ using System; using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; +using System.Runtime.InteropServices; using System.Windows.Forms; namespace Sunny.UI @@ -63,6 +64,13 @@ namespace Sunny.UI edit.BackColor = Color.White; } + [DefaultValue(null)] + public string Watermark + { + get => edit.Watermark; + set => edit.Watermark = value; + } + private UIDropDown itemForm; protected UIDropDown ItemForm @@ -132,7 +140,7 @@ namespace Sunny.UI public event EventHandler ButtonClick; - private readonly TextBox edit = new TextBox(); + private readonly TextBoxEx edit = new TextBoxEx(); protected override void OnTextChanged(EventArgs e) { @@ -301,5 +309,25 @@ namespace Sunny.UI ButtonClick?.Invoke(this, e); } } + + private class TextBoxEx : TextBox + { + private string watermark; + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, string lParam); + + + [DefaultValue(null)] + public string Watermark + { + get => watermark; + set + { + watermark = value; + SendMessage(Handle, 0x1501, (int)IntPtr.Zero, value); + } + } + } } } \ No newline at end of file diff --git a/SunnyUI/Controls/UIEdit.cs b/SunnyUI/Controls/UIEdit.cs index d571d254..ef5de2df 100644 --- a/SunnyUI/Controls/UIEdit.cs +++ b/SunnyUI/Controls/UIEdit.cs @@ -1,6 +1,7 @@ using System; using System.ComponentModel; using System.Globalization; +using System.Runtime.InteropServices; using System.Windows.Forms; namespace Sunny.UI @@ -27,6 +28,22 @@ namespace Sunny.UI MaxLength = 255; } + private string watermark; + + [DefaultValue(null)] + public string Watermark + { + get => watermark; + set + { + watermark = value; + SendMessage(Handle, 0x1501, (int)IntPtr.Zero, value); + } + } + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, string lParam); + protected override void OnKeyDown(KeyEventArgs e) { if (e.KeyData == Keys.Enter || e.KeyData == Keys.Down) diff --git a/SunnyUI/Controls/UITextBox.cs b/SunnyUI/Controls/UITextBox.cs index 553566fb..f55588b2 100644 --- a/SunnyUI/Controls/UITextBox.cs +++ b/SunnyUI/Controls/UITextBox.cs @@ -51,6 +51,13 @@ namespace Sunny.UI Width = 150; } + [DefaultValue(null)] + public string Watermark + { + get => edit.Watermark; + set => edit.Watermark = value; + } + public void SelectAll() { edit.SelectAll(); diff --git a/SunnyUI/Static/ULocalize.cs b/SunnyUI/Static/ULocalize.cs index 877c58e4..c8262474 100644 --- a/SunnyUI/Static/ULocalize.cs +++ b/SunnyUI/Static/ULocalize.cs @@ -28,16 +28,47 @@ namespace Sunny.UI public static string WarningTitle = "警告"; public static string ErrorTitle = "错误"; public static string AskTitle = "提示"; - public static string InputTitle = "输入"; - public static string CloseAll = "全部关闭"; - public static string OK = "确定"; public static string Cancel = "取消"; - public static string GridNoData = "[ 无数据 ]"; public static string GridDataLoading = "数据加载中 ......"; public static string GridDataSourceException = "数据源必须为DataTable或者List"; } + + public static class UILocalizeHelper + { + public static void SetEN() + { + UILocalize.InfoTitle = "Info"; + UILocalize.SuccessTitle = "Success"; + UILocalize.WarningTitle = "Warning"; + UILocalize.ErrorTitle = "Error"; + UILocalize.AskTitle = "Query"; + UILocalize.InputTitle = "Input"; + UILocalize.CloseAll = "Close all"; + UILocalize.OK = "OK"; + UILocalize.Cancel = "Cancel"; + UILocalize.GridNoData = "[ No data ]"; + UILocalize.GridDataLoading = "Data loading ......"; + UILocalize.GridDataSourceException = "The data source must be DataTable or List"; + } + + public static void SetCH() + { + UILocalize.InfoTitle = "提示"; + UILocalize.SuccessTitle = "正确"; + UILocalize.WarningTitle = "警告"; + UILocalize.ErrorTitle = "错误"; + UILocalize.AskTitle = "提示"; + UILocalize.InputTitle = "输入"; + UILocalize.CloseAll = "全部关闭"; + UILocalize.OK = "确定"; + UILocalize.Cancel = "取消"; + UILocalize.GridNoData = "[ 无数据 ]"; + UILocalize.GridDataLoading = "数据加载中 ......"; + UILocalize.GridDataSourceException = "数据源必须为DataTable或者List"; + } + } } \ No newline at end of file diff --git a/Updates.txt b/Updates.txt index 8e3a4b1c..aa29b42e 100644 --- a/Updates.txt +++ b/Updates.txt @@ -1,5 +1,9 @@ + ӣ - ɾ * ޸ +2020.05.25 ++ UITextBoxWatermarkˮӡ ++ ULocalize.csӶ + 2020.05.23 V2.2.5 * ޸ͼһBug