From 98c7a8f81e24479281ee30943f3880f721623886 Mon Sep 17 00:00:00 2001 From: Sunny Date: Fri, 13 Sep 2024 23:43:27 +0800 Subject: [PATCH] =?UTF-8?q?*=20=E9=87=8D=E6=9E=84=E5=A4=9A=E8=AF=AD?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Common/UControl.cs | 18 ++--- SunnyUI/Common/UFile.cs | 4 +- SunnyUI/Common/ULocalize.cs | 22 +++--- SunnyUI/Controls/DropItem/UIColorItem.cs | 4 +- .../DropItem/UIComboDataGridViewItem.cs | 8 +- .../Controls/DropItem/UIComboTreeViewItem.cs | 6 +- SunnyUI/Controls/DropItem/UIDateItem.cs | 30 ++++---- SunnyUI/Controls/DropItem/UIDateTimeItem.cs | 34 ++++---- SunnyUI/Controls/DropItem/UITimeItem.cs | 4 +- SunnyUI/Controls/UIButton.cs | 3 + SunnyUI/Controls/UICalendar.cs | 26 +++---- SunnyUI/Controls/UIControl.cs | 10 ++- SunnyUI/Controls/UIMiniPagination.cs | 2 +- SunnyUI/Controls/UINavMenuHelper.cs | 2 + SunnyUI/Controls/UIPagination.cs | 74 +++++++++++------- SunnyUI/Controls/UIPagination.resx | 4 +- SunnyUI/Forms/UIBaseForm.cs | 30 +++++--- SunnyUI/Forms/UIEditForm.cs | 8 +- SunnyUI/Forms/UIFormHelper.cs | 62 +++++++-------- SunnyUI/Forms/UIMessageForm.cs | 4 +- SunnyUI/Forms/UIMessageForm2.cs | 4 +- SunnyUI/Forms/UINotifier.cs | 4 +- SunnyUI/Forms/UIStatusForm.cs | 6 +- SunnyUI/Forms/UIWaitForm.cs | 6 +- SunnyUI/Frames/UIPage.cs | 6 ++ SunnyUI/Style/UIStyle.cs | 20 ----- SunnyUI/Style/UIStyles.cs | 29 +++---- SunnyUI/Style/UTranslate.cs | 77 ++++++++++++++++++- 28 files changed, 304 insertions(+), 203 deletions(-) diff --git a/SunnyUI/Common/UControl.cs b/SunnyUI/Common/UControl.cs index a7c1167a..9f592998 100644 --- a/SunnyUI/Common/UControl.cs +++ b/SunnyUI/Common/UControl.cs @@ -372,14 +372,11 @@ namespace Sunny.UI internal static void HideComboDropDown(this Control ctrl) { - var ctrls = ctrl?.FindForm()?.GetInterfaceControls("IHideDropDown", true); + var ctrls = ctrl?.FindForm()?.GetInterfaceControls(true); if (ctrls == null) return; foreach (var control in ctrls) { - if (control is IHideDropDown item) - { - item.HideDropDown(); - } + control.HideDropDown(); } } @@ -390,21 +387,22 @@ namespace Sunny.UI /// 接口名称 /// /// 控件列表 - public static List GetInterfaceControls(this Control ctrl, string interfaceName, bool includeChild = false) + public static List GetInterfaceControls(this Control ctrl, bool includeChild = false, bool includeUIPage = true) { - List values = new List(); + List values = new(); if (ctrl.IsNull()) return values; foreach (Control obj in ctrl.Controls) { - if (obj.GetType().GetInterface(interfaceName) != null) + if (obj is T it && it != null) { - values.Add(obj); + values.Add(it); } if (includeChild && obj.Controls.Count > 0) { - values.AddRange(obj.GetInterfaceControls(interfaceName, true)); + if (obj is not UIPage || includeUIPage) + values.AddRange(obj.GetInterfaceControls(includeChild, includeUIPage)); } } diff --git a/SunnyUI/Common/UFile.cs b/SunnyUI/Common/UFile.cs index 15968cfd..a6413c60 100644 --- a/SunnyUI/Common/UFile.cs +++ b/SunnyUI/Common/UFile.cs @@ -62,7 +62,7 @@ namespace Sunny.UI /// 打开是否成功 public static bool OpenDialog(ref string filename, string filter = "", string defaultExt = "") { - using OpenFileDialog od = new OpenFileDialog { Title = UIStyles.Localize.Open }; + using OpenFileDialog od = new OpenFileDialog { Title = UIStyles.CurrentResources.Open }; try { @@ -89,7 +89,7 @@ namespace Sunny.UI /// 保存是否成功 public static bool SaveDialog(ref string filename, string filter = "", string defaultExt = "") { - using SaveFileDialog od = new SaveFileDialog { Title = UIStyles.Localize.Save }; + using SaveFileDialog od = new SaveFileDialog { Title = UIStyles.CurrentResources.Save }; try { od.FileName = filename; diff --git a/SunnyUI/Common/ULocalize.cs b/SunnyUI/Common/ULocalize.cs index 9403b32d..69c6e209 100644 --- a/SunnyUI/Common/ULocalize.cs +++ b/SunnyUI/Common/ULocalize.cs @@ -59,42 +59,42 @@ namespace Sunny.UI /// /// 2052 简体中文 /// - public const int LCID_ZH_CN = 2052; + public const int LCID_zh_CN = 2052; /// /// 1028 繁体中文 /// - public const int LCID_ZH_TW = 1028; + public const int LCID_zh_TW = 1028; /// /// 1033 英语 /// - public const int LCID_EN_US = 1033; + public const int LCID_en_US = 1033; /// /// 2052 简体中文 /// - public static CultureInfo SimplifiedChinese = CultureInfo.GetCultureInfo(LCID_ZH_CN); + public static readonly CultureInfo zh_CN = CultureInfo.GetCultureInfo(LCID_zh_CN); /// /// 1028 繁体中文 /// - public static CultureInfo TraditionalChinese = CultureInfo.GetCultureInfo(LCID_ZH_TW); + public static readonly CultureInfo zh_TW = CultureInfo.GetCultureInfo(LCID_zh_TW); /// /// 1033 英语 /// - public static CultureInfo English = CultureInfo.GetCultureInfo(LCID_EN_US); + public static readonly CultureInfo en_US = CultureInfo.GetCultureInfo(LCID_en_US); } - public class UILocalize_ZH_CN : UILocalize + public class zh_CN_Resources : UIBuiltInResources { - public override CultureInfo CultureInfo => CultureInfos.SimplifiedChinese; + public override CultureInfo CultureInfo => CultureInfos.zh_CN; } - public class UILocalize_EN_US : UILocalize + public class en_US_Resources : UIBuiltInResources { - public override CultureInfo CultureInfo => CultureInfos.English; + public override CultureInfo CultureInfo => CultureInfos.en_US; public override string InfoTitle { get; set; } = "Info"; public override string SuccessTitle { get; set; } = "Success"; public override string WarningTitle { get; set; } = "Warning"; @@ -143,7 +143,7 @@ namespace Sunny.UI /// /// 多语言字符串定义 /// - public abstract class UILocalize + public abstract class UIBuiltInResources { public abstract CultureInfo CultureInfo { get; } diff --git a/SunnyUI/Controls/DropItem/UIColorItem.cs b/SunnyUI/Controls/DropItem/UIColorItem.cs index bd377ac8..36168ffa 100644 --- a/SunnyUI/Controls/DropItem/UIColorItem.cs +++ b/SunnyUI/Controls/DropItem/UIColorItem.cs @@ -27,8 +27,8 @@ namespace Sunny.UI public void Translate() { - btnOK.Text = UIStyles.Localize.OK; - btnCancel.Text = UIStyles.Localize.Cancel; + btnOK.Text = UIStyles.CurrentResources.OK; + btnCancel.Text = UIStyles.CurrentResources.Cancel; } private LabelRotate m_colorSample; diff --git a/SunnyUI/Controls/DropItem/UIComboDataGridViewItem.cs b/SunnyUI/Controls/DropItem/UIComboDataGridViewItem.cs index bf9d526e..891a8949 100644 --- a/SunnyUI/Controls/DropItem/UIComboDataGridViewItem.cs +++ b/SunnyUI/Controls/DropItem/UIComboDataGridViewItem.cs @@ -84,10 +84,10 @@ namespace Sunny.UI public void Translate() { - btnOK.Text = UIStyles.Localize.OK; - btnCancel.Text = UIStyles.Localize.Cancel; - btnClear.Text = UIStyles.Localize.Clear; - btnSearch.Text = UIStyles.Localize.Search; + btnOK.Text = UIStyles.CurrentResources.OK; + btnCancel.Text = UIStyles.CurrentResources.Cancel; + btnClear.Text = UIStyles.CurrentResources.Clear; + btnSearch.Text = UIStyles.CurrentResources.Search; } public bool ShowButtons diff --git a/SunnyUI/Controls/DropItem/UIComboTreeViewItem.cs b/SunnyUI/Controls/DropItem/UIComboTreeViewItem.cs index 9fc58545..1155c142 100644 --- a/SunnyUI/Controls/DropItem/UIComboTreeViewItem.cs +++ b/SunnyUI/Controls/DropItem/UIComboTreeViewItem.cs @@ -52,9 +52,9 @@ namespace Sunny.UI public void Translate() { - btnOK.Text = UIStyles.Localize.OK; - btnCancel.Text = UIStyles.Localize.Cancel; - uiCheckBox1.Text = UIStyles.Localize.All; + btnOK.Text = UIStyles.CurrentResources.OK; + btnCancel.Text = UIStyles.CurrentResources.Cancel; + uiCheckBox1.Text = UIStyles.CurrentResources.All; } private void InitializeComponent() diff --git a/SunnyUI/Controls/DropItem/UIDateItem.cs b/SunnyUI/Controls/DropItem/UIDateItem.cs index 0b5f83e9..3365ac96 100644 --- a/SunnyUI/Controls/DropItem/UIDateItem.cs +++ b/SunnyUI/Controls/DropItem/UIDateItem.cs @@ -382,18 +382,18 @@ namespace Sunny.UI public void Translate() { months.Clear(); - months.Add(UIStyles.Localize.January); - months.Add(UIStyles.Localize.February); - months.Add(UIStyles.Localize.March); - months.Add(UIStyles.Localize.April); - months.Add(UIStyles.Localize.May); - months.Add(UIStyles.Localize.June); - months.Add(UIStyles.Localize.July); - months.Add(UIStyles.Localize.August); - months.Add(UIStyles.Localize.September); - months.Add(UIStyles.Localize.October); - months.Add(UIStyles.Localize.November); - months.Add(UIStyles.Localize.December); + months.Add(UIStyles.CurrentResources.January); + months.Add(UIStyles.CurrentResources.February); + months.Add(UIStyles.CurrentResources.March); + months.Add(UIStyles.CurrentResources.April); + months.Add(UIStyles.CurrentResources.May); + months.Add(UIStyles.CurrentResources.June); + months.Add(UIStyles.CurrentResources.July); + months.Add(UIStyles.CurrentResources.August); + months.Add(UIStyles.CurrentResources.September); + months.Add(UIStyles.CurrentResources.October); + months.Add(UIStyles.CurrentResources.November); + months.Add(UIStyles.CurrentResources.December); } private void TopPanel_Click(object sender, EventArgs e) @@ -788,7 +788,7 @@ namespace Sunny.UI int width = p3.Width / 7; int height = (p3.Height - 30 * SizeMultiple) / 6; using Font font = SizeMultiple == 1 ? this.Font : new Font(this.Font.FontFamily, this.Font.Size * 1.5f); - string[] weeks = { UIStyles.Localize.Sunday, UIStyles.Localize.Monday, UIStyles.Localize.Tuesday, UIStyles.Localize.Wednesday, UIStyles.Localize.Thursday, UIStyles.Localize.Friday, UIStyles.Localize.Saturday }; + string[] weeks = { UIStyles.CurrentResources.Sunday, UIStyles.CurrentResources.Monday, UIStyles.CurrentResources.Tuesday, UIStyles.CurrentResources.Wednesday, UIStyles.CurrentResources.Thursday, UIStyles.CurrentResources.Friday, UIStyles.CurrentResources.Saturday }; for (int i = 0; i < weeks.Length; i++) { e.Graphics.DrawString(weeks[i], font, ForeColor, new Rectangle(width * i, 4 * SizeMultiple, width, 19 * SizeMultiple), ContentAlignment.MiddleCenter); @@ -826,8 +826,8 @@ namespace Sunny.UI { using Font SubFont = this.Font.DPIScaleFont(SizeMultiple == 1 ? 10.5f : 15.75f); e.Graphics.FillRectangle(p3.FillColor, p3.Width - width * 4 + 1, p3.Height - height + 1, width * 4 - 2, height - 2); - e.Graphics.DrawString(UIStyles.Localize.Today + " " + DateTime.Now.DateString(), SubFont, isToday ? b3.SymbolColor : Color.DarkGray, new Rectangle(p3.Width - width * 4, p3.Height - height - 1, Width, height), ContentAlignment.MiddleLeft); - SizeF sf = TextRenderer.MeasureText(UIStyles.Localize.Today, SubFont); + e.Graphics.DrawString(UIStyles.CurrentResources.Today + " " + DateTime.Now.DateString(), SubFont, isToday ? b3.SymbolColor : Color.DarkGray, new Rectangle(p3.Width - width * 4, p3.Height - height - 1, Width, height), ContentAlignment.MiddleLeft); + SizeF sf = TextRenderer.MeasureText(UIStyles.CurrentResources.Today, SubFont); e.Graphics.DrawRectangle(b3.SymbolColor, new Rectangle(p3.Width - width * 4 + 1, p3.Height - height + 1, (int)sf.Width - 2, height - 4)); } } diff --git a/SunnyUI/Controls/DropItem/UIDateTimeItem.cs b/SunnyUI/Controls/DropItem/UIDateTimeItem.cs index a8738e42..0fea4f65 100644 --- a/SunnyUI/Controls/DropItem/UIDateTimeItem.cs +++ b/SunnyUI/Controls/DropItem/UIDateTimeItem.cs @@ -780,21 +780,21 @@ namespace Sunny.UI public void Translate() { months.Clear(); - months.Add(UIStyles.Localize.January); - months.Add(UIStyles.Localize.February); - months.Add(UIStyles.Localize.March); - months.Add(UIStyles.Localize.April); - months.Add(UIStyles.Localize.May); - months.Add(UIStyles.Localize.June); - months.Add(UIStyles.Localize.July); - months.Add(UIStyles.Localize.August); - months.Add(UIStyles.Localize.September); - months.Add(UIStyles.Localize.October); - months.Add(UIStyles.Localize.November); - months.Add(UIStyles.Localize.December); + months.Add(UIStyles.CurrentResources.January); + months.Add(UIStyles.CurrentResources.February); + months.Add(UIStyles.CurrentResources.March); + months.Add(UIStyles.CurrentResources.April); + months.Add(UIStyles.CurrentResources.May); + months.Add(UIStyles.CurrentResources.June); + months.Add(UIStyles.CurrentResources.July); + months.Add(UIStyles.CurrentResources.August); + months.Add(UIStyles.CurrentResources.September); + months.Add(UIStyles.CurrentResources.October); + months.Add(UIStyles.CurrentResources.November); + months.Add(UIStyles.CurrentResources.December); - btnOK.Text = UIStyles.Localize.OK; - btnCancel.Text = UIStyles.Localize.Cancel; + btnOK.Text = UIStyles.CurrentResources.OK; + btnCancel.Text = UIStyles.CurrentResources.Cancel; } private int activeDay = -1; @@ -1267,7 +1267,7 @@ namespace Sunny.UI int width = p3.Width / 7; int height = (p3.Height - 30 * SizeMultiple) / 6; using Font font = SizeMultiple == 1 ? this.Font : new Font(this.Font.FontFamily, this.Font.Size * 1.5f); - string[] weeks = { UIStyles.Localize.Sunday, UIStyles.Localize.Monday, UIStyles.Localize.Tuesday, UIStyles.Localize.Wednesday, UIStyles.Localize.Thursday, UIStyles.Localize.Friday, UIStyles.Localize.Saturday }; + string[] weeks = { UIStyles.CurrentResources.Sunday, UIStyles.CurrentResources.Monday, UIStyles.CurrentResources.Tuesday, UIStyles.CurrentResources.Wednesday, UIStyles.CurrentResources.Thursday, UIStyles.CurrentResources.Friday, UIStyles.CurrentResources.Saturday }; for (int i = 0; i < weeks.Length; i++) { e.Graphics.DrawString(weeks[i], font, ForeColor, new Rectangle(width * i, 4 * SizeMultiple, width, 19 * SizeMultiple), ContentAlignment.MiddleCenter); @@ -1303,8 +1303,8 @@ namespace Sunny.UI { using Font SubFont = this.Font.DPIScaleFont(SizeMultiple == 1 ? 10.5f : 15.75f); e.Graphics.FillRectangle(p3.FillColor, p3.Width - width * 4 + 1, p3.Height - height + 1, width * 4 - 2, height - 2); - e.Graphics.DrawString(UIStyles.Localize.Today + " " + DateTime.Now.DateString(), SubFont, isToday ? b3.SymbolColor : Color.DarkGray, new Rectangle(p3.Width - width * 4, p3.Height - height - 1, Width, height), ContentAlignment.MiddleLeft); - SizeF sf = TextRenderer.MeasureText(UIStyles.Localize.Today, SubFont); + e.Graphics.DrawString(UIStyles.CurrentResources.Today + " " + DateTime.Now.DateString(), SubFont, isToday ? b3.SymbolColor : Color.DarkGray, new Rectangle(p3.Width - width * 4, p3.Height - height - 1, Width, height), ContentAlignment.MiddleLeft); + SizeF sf = TextRenderer.MeasureText(UIStyles.CurrentResources.Today, SubFont); e.Graphics.DrawRectangle(b3.SymbolColor, new Rectangle(p3.Width - width * 4 + 1, p3.Height - height + 1, (int)sf.Width - 2, height - 4)); } } diff --git a/SunnyUI/Controls/DropItem/UITimeItem.cs b/SunnyUI/Controls/DropItem/UITimeItem.cs index 5a70013a..5c3ec328 100644 --- a/SunnyUI/Controls/DropItem/UITimeItem.cs +++ b/SunnyUI/Controls/DropItem/UITimeItem.cs @@ -403,8 +403,8 @@ namespace Sunny.UI public void Translate() { - btnOK.Text = UIStyles.Localize.OK; - btnCancel.Text = UIStyles.Localize.Cancel; + btnOK.Text = UIStyles.CurrentResources.OK; + btnCancel.Text = UIStyles.CurrentResources.Cancel; } public override void SetDPIScale() diff --git a/SunnyUI/Controls/UIButton.cs b/SunnyUI/Controls/UIButton.cs index 9a698d12..b07c3a07 100644 --- a/SunnyUI/Controls/UIButton.cs +++ b/SunnyUI/Controls/UIButton.cs @@ -83,6 +83,9 @@ namespace Sunny.UI UseMnemonic = true; } + [Browsable(false)] + public override string[] FormTranslatorProperties => ["Text"]; + [DefaultValue(true)] [Description("如果为true,&符号后面的第一次字符将做按钮的助记键"), Category("SunnyUI")] public bool UseMnemonic { get; set; } diff --git a/SunnyUI/Controls/UICalendar.cs b/SunnyUI/Controls/UICalendar.cs index 9e997cfb..1d4502e9 100644 --- a/SunnyUI/Controls/UICalendar.cs +++ b/SunnyUI/Controls/UICalendar.cs @@ -313,18 +313,18 @@ namespace Sunny.UI public void Translate() { months.Clear(); - months.Add(UIStyles.Localize.January); - months.Add(UIStyles.Localize.February); - months.Add(UIStyles.Localize.March); - months.Add(UIStyles.Localize.April); - months.Add(UIStyles.Localize.May); - months.Add(UIStyles.Localize.June); - months.Add(UIStyles.Localize.July); - months.Add(UIStyles.Localize.August); - months.Add(UIStyles.Localize.September); - months.Add(UIStyles.Localize.October); - months.Add(UIStyles.Localize.November); - months.Add(UIStyles.Localize.December); + months.Add(UIStyles.CurrentResources.January); + months.Add(UIStyles.CurrentResources.February); + months.Add(UIStyles.CurrentResources.March); + months.Add(UIStyles.CurrentResources.April); + months.Add(UIStyles.CurrentResources.May); + months.Add(UIStyles.CurrentResources.June); + months.Add(UIStyles.CurrentResources.July); + months.Add(UIStyles.CurrentResources.August); + months.Add(UIStyles.CurrentResources.September); + months.Add(UIStyles.CurrentResources.October); + months.Add(UIStyles.CurrentResources.November); + months.Add(UIStyles.CurrentResources.December); } private void TopPanel_Click(object sender, EventArgs e) @@ -677,7 +677,7 @@ namespace Sunny.UI { int width = p3.Width / 7; int height = (p3.Height - 30) / 6; - string[] weeks = { UIStyles.Localize.Sunday, UIStyles.Localize.Monday, UIStyles.Localize.Tuesday, UIStyles.Localize.Wednesday, UIStyles.Localize.Thursday, UIStyles.Localize.Friday, UIStyles.Localize.Saturday }; + string[] weeks = { UIStyles.CurrentResources.Sunday, UIStyles.CurrentResources.Monday, UIStyles.CurrentResources.Tuesday, UIStyles.CurrentResources.Wednesday, UIStyles.CurrentResources.Thursday, UIStyles.CurrentResources.Friday, UIStyles.CurrentResources.Saturday }; for (int i = 0; i < weeks.Length; i++) { e.Graphics.DrawString(weeks[i], Font, ForeColor, new Rectangle(width * i, 4, width, 19), ContentAlignment.MiddleCenter); diff --git a/SunnyUI/Controls/UIControl.cs b/SunnyUI/Controls/UIControl.cs index c9251214..b801fd09 100644 --- a/SunnyUI/Controls/UIControl.cs +++ b/SunnyUI/Controls/UIControl.cs @@ -40,7 +40,7 @@ namespace Sunny.UI /// 控件基类 /// [ToolboxItem(false)] - public class UIControl : Control, IStyleInterface, IZoomScale + public class UIControl : Control, IStyleInterface, IZoomScale, IFormTranslator { /// /// 构造函数 @@ -53,6 +53,14 @@ namespace Sunny.UI base.MinimumSize = new Size(1, 1); } + [Browsable(false)] + [Description("控件在界面显示时需要多语翻译的属性名称数组"), Category("SunnyUI")] + public virtual string[] FormTranslatorProperties { get; } + + [DefaultValue(false)] + [Description("控件是否显示多语内置资源"), Category("SunnyUI")] + public bool ShowBuiltInResources { get; set; } = false; + [Browsable(false)] public bool Disabled => !Enabled; diff --git a/SunnyUI/Controls/UIMiniPagination.cs b/SunnyUI/Controls/UIMiniPagination.cs index 941c137f..442a5947 100644 --- a/SunnyUI/Controls/UIMiniPagination.cs +++ b/SunnyUI/Controls/UIMiniPagination.cs @@ -259,7 +259,7 @@ namespace Sunny.UI { if (!(value is DataTable || value is IList)) { - throw new Exception(UIStyles.Localize.GridDataSourceException); + throw new Exception(UIStyles.CurrentResources.GridDataSourceException); } } diff --git a/SunnyUI/Controls/UINavMenuHelper.cs b/SunnyUI/Controls/UINavMenuHelper.cs index be817669..be792270 100644 --- a/SunnyUI/Controls/UINavMenuHelper.cs +++ b/SunnyUI/Controls/UINavMenuHelper.cs @@ -375,6 +375,7 @@ namespace Sunny.UI { bool isCancel = pages[0].OnPageDeselecting(); if (isCancel) return false; + pages[0].Translate(); } foreach (var item in PageItems) @@ -405,6 +406,7 @@ namespace Sunny.UI { bool isCancel = pages[0].OnPageDeselecting(); if (isCancel) return false; + pages[0].Translate(); } foreach (var item in PageItems) diff --git a/SunnyUI/Controls/UIPagination.cs b/SunnyUI/Controls/UIPagination.cs index 16abbe2d..2331d740 100644 --- a/SunnyUI/Controls/UIPagination.cs +++ b/SunnyUI/Controls/UIPagination.cs @@ -114,6 +114,7 @@ namespace Sunny.UI buttons[i].MouseEnter += UIDataGridPage_MouseEnter; buttons[i].MouseLeave += UIDataGridPage_MouseLeave; buttons[i].Click += UIDataGridPage_Click; + buttons[i].ShowBuiltInResources = true; } buttonTags.TryAdd(b0, -1); @@ -170,9 +171,9 @@ namespace Sunny.UI try { - b0.Text = UIStyles.Localize.Prev; - b16.Text = UIStyles.Localize.Next; - btnSelect.Text = UIStyles.Localize.SelectTitle; + b0.Text = UIStyles.CurrentResources.Prev; + b16.Text = UIStyles.CurrentResources.Next; + btnSelect.Text = UIStyles.CurrentResources.SelectTitle; Size sf = TextRenderer.MeasureText(b0.Text, b0.Font); b0.Width = b0.SymbolSize + sf.Width + 10; @@ -182,8 +183,8 @@ namespace Sunny.UI btnSelect.Width = TextRenderer.MeasureText(btnSelect.Text, btnSelect.Font).Width + 16; - uiLabel1.Text = UIStyles.Localize.SelectPageLeft; - uiLabel2.Text = UIStyles.Localize.SelectPageRight; + uiLabel1.Text = UIStyles.CurrentResources.SelectPageLeft; + uiLabel2.Text = UIStyles.CurrentResources.SelectPageRight; edtPage.Left = uiLabel1.Right + 3; uiLabel2.Left = edtPage.Right + 3; btnSelect.Left = uiLabel2.Right + 3; @@ -309,7 +310,7 @@ namespace Sunny.UI { if (!(value is DataTable || value is IList)) { - throw new Exception(UIStyles.Localize.GridDataSourceException); + throw new Exception(UIStyles.CurrentResources.GridDataSourceException); } } @@ -390,7 +391,7 @@ namespace Sunny.UI // b0 // b0.Cursor = Cursors.Hand; - b0.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point); + b0.Font = new Font("宋体", 10.5F); b0.ImageAlign = ContentAlignment.MiddleLeft; b0.Location = new Point(3, 3); b0.MinimumSize = new Size(1, 1); @@ -403,11 +404,12 @@ namespace Sunny.UI b0.TagString = "<"; b0.Text = "上一页"; b0.TextAlign = ContentAlignment.MiddleRight; + b0.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b1 // b1.Cursor = Cursors.Hand; - b1.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + b1.Font = new Font("宋体", 12F); b1.Location = new Point(81, 3); b1.MinimumSize = new Size(1, 1); b1.Name = "b1"; @@ -416,11 +418,12 @@ namespace Sunny.UI b1.Symbol = 0; b1.TabIndex = 1; b1.Text = "0"; + b1.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b3 // b3.Cursor = Cursors.Hand; - b3.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + b3.Font = new Font("宋体", 12F); b3.Location = new Point(145, 3); b3.MinimumSize = new Size(1, 1); b3.Name = "b3"; @@ -429,11 +432,12 @@ namespace Sunny.UI b3.Symbol = 0; b3.TabIndex = 3; b3.Text = "0"; + b3.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b2 // b2.Cursor = Cursors.Hand; - b2.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + b2.Font = new Font("宋体", 12F); b2.Location = new Point(113, 3); b2.MinimumSize = new Size(1, 1); b2.Name = "b2"; @@ -442,11 +446,12 @@ namespace Sunny.UI b2.Symbol = 0; b2.TabIndex = 2; b2.Text = "0"; + b2.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b7 // b7.Cursor = Cursors.Hand; - b7.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + b7.Font = new Font("宋体", 12F); b7.Location = new Point(273, 3); b7.MinimumSize = new Size(1, 1); b7.Name = "b7"; @@ -455,11 +460,12 @@ namespace Sunny.UI b7.Symbol = 0; b7.TabIndex = 7; b7.Text = "0"; + b7.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b6 // b6.Cursor = Cursors.Hand; - b6.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + b6.Font = new Font("宋体", 12F); b6.Location = new Point(241, 3); b6.MinimumSize = new Size(1, 1); b6.Name = "b6"; @@ -468,11 +474,12 @@ namespace Sunny.UI b6.Symbol = 0; b6.TabIndex = 6; b6.Text = "0"; + b6.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b5 // b5.Cursor = Cursors.Hand; - b5.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + b5.Font = new Font("宋体", 12F); b5.Location = new Point(209, 3); b5.MinimumSize = new Size(1, 1); b5.Name = "b5"; @@ -481,11 +488,12 @@ namespace Sunny.UI b5.Symbol = 0; b5.TabIndex = 5; b5.Text = "0"; + b5.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b4 // b4.Cursor = Cursors.Hand; - b4.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + b4.Font = new Font("宋体", 12F); b4.Location = new Point(177, 3); b4.MinimumSize = new Size(1, 1); b4.Name = "b4"; @@ -494,11 +502,12 @@ namespace Sunny.UI b4.Symbol = 0; b4.TabIndex = 4; b4.Text = "0"; + b4.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b15 // b15.Cursor = Cursors.Hand; - b15.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + b15.Font = new Font("宋体", 12F); b15.Location = new Point(529, 3); b15.MinimumSize = new Size(1, 1); b15.Name = "b15"; @@ -507,11 +516,12 @@ namespace Sunny.UI b15.Symbol = 0; b15.TabIndex = 15; b15.Text = "0"; + b15.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b14 // b14.Cursor = Cursors.Hand; - b14.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + b14.Font = new Font("宋体", 12F); b14.Location = new Point(497, 3); b14.MinimumSize = new Size(1, 1); b14.Name = "b14"; @@ -520,11 +530,12 @@ namespace Sunny.UI b14.Symbol = 0; b14.TabIndex = 14; b14.Text = "0"; + b14.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b13 // b13.Cursor = Cursors.Hand; - b13.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + b13.Font = new Font("宋体", 12F); b13.Location = new Point(465, 3); b13.MinimumSize = new Size(1, 1); b13.Name = "b13"; @@ -533,11 +544,12 @@ namespace Sunny.UI b13.Symbol = 0; b13.TabIndex = 13; b13.Text = "0"; + b13.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b12 // b12.Cursor = Cursors.Hand; - b12.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + b12.Font = new Font("宋体", 12F); b12.Location = new Point(433, 3); b12.MinimumSize = new Size(1, 1); b12.Name = "b12"; @@ -546,11 +558,12 @@ namespace Sunny.UI b12.Symbol = 0; b12.TabIndex = 12; b12.Text = "0"; + b12.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b11 // b11.Cursor = Cursors.Hand; - b11.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + b11.Font = new Font("宋体", 12F); b11.Location = new Point(401, 3); b11.MinimumSize = new Size(1, 1); b11.Name = "b11"; @@ -559,11 +572,12 @@ namespace Sunny.UI b11.Symbol = 0; b11.TabIndex = 11; b11.Text = "0"; + b11.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b10 // b10.Cursor = Cursors.Hand; - b10.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + b10.Font = new Font("宋体", 12F); b10.Location = new Point(369, 3); b10.MinimumSize = new Size(1, 1); b10.Name = "b10"; @@ -572,11 +586,12 @@ namespace Sunny.UI b10.Symbol = 0; b10.TabIndex = 10; b10.Text = "0"; + b10.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b9 // b9.Cursor = Cursors.Hand; - b9.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + b9.Font = new Font("宋体", 12F); b9.Location = new Point(337, 3); b9.MinimumSize = new Size(1, 1); b9.Name = "b9"; @@ -585,11 +600,12 @@ namespace Sunny.UI b9.Symbol = 0; b9.TabIndex = 9; b9.Text = "0"; + b9.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b8 // b8.Cursor = Cursors.Hand; - b8.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + b8.Font = new Font("宋体", 12F); b8.Location = new Point(305, 3); b8.MinimumSize = new Size(1, 1); b8.Name = "b8"; @@ -598,11 +614,12 @@ namespace Sunny.UI b8.Symbol = 0; b8.TabIndex = 8; b8.Text = "0"; + b8.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); // // b16 // b16.Cursor = Cursors.Hand; - b16.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point); + b16.Font = new Font("宋体", 10.5F); b16.ImageAlign = ContentAlignment.MiddleRight; b16.Location = new Point(561, 3); b16.MinimumSize = new Size(1, 1); @@ -615,13 +632,14 @@ namespace Sunny.UI b16.TagString = ">"; b16.Text = "下一页"; b16.TextAlign = ContentAlignment.MiddleLeft; + b16.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); b16.LocationChanged += b16_LocationChanged; // // edtPage // edtPage.Cursor = Cursors.IBeam; edtPage.DoubleValue = 10D; - edtPage.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point); + edtPage.Font = new Font("宋体", 12F); edtPage.IntValue = 10; edtPage.Location = new Point(673, 3); edtPage.Margin = new Padding(4, 5, 4, 5); @@ -640,21 +658,23 @@ namespace Sunny.UI // btnSelect // btnSelect.Cursor = Cursors.Hand; - btnSelect.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point); + btnSelect.Font = new Font("宋体", 10.5F); btnSelect.Location = new Point(756, 3); btnSelect.MinimumSize = new Size(1, 1); btnSelect.Name = "btnSelect"; + btnSelect.ShowBuiltInResources = true; btnSelect.Size = new Size(61, 29); btnSelect.Symbol = 0; btnSelect.TabIndex = 3; btnSelect.Text = "确定"; + btnSelect.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); btnSelect.Click += btnSelect_Click; // // uiLabel2 // uiLabel2.AutoSize = true; uiLabel2.BackColor = Color.Transparent; - uiLabel2.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point); + uiLabel2.Font = new Font("宋体", 10.5F); uiLabel2.ForeColor = Color.FromArgb(48, 48, 48); uiLabel2.Location = new Point(726, 10); uiLabel2.Name = "uiLabel2"; @@ -667,7 +687,7 @@ namespace Sunny.UI // uiLabel1.AutoSize = true; uiLabel1.BackColor = Color.Transparent; - uiLabel1.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point); + uiLabel1.Font = new Font("宋体", 10.5F); uiLabel1.ForeColor = Color.FromArgb(48, 48, 48); uiLabel1.Location = new Point(650, 10); uiLabel1.Name = "uiLabel1"; diff --git a/SunnyUI/Controls/UIPagination.resx b/SunnyUI/Controls/UIPagination.resx index af32865e..8b2ff64a 100644 --- a/SunnyUI/Controls/UIPagination.resx +++ b/SunnyUI/Controls/UIPagination.resx @@ -1,7 +1,7 @@