From a411027eb1045d4d565029343b42a0b3f189dfbc Mon Sep 17 00:00:00 2001 From: Sunny Date: Sat, 5 Oct 2024 22:11:46 +0800 Subject: [PATCH] =?UTF-8?q?*=20UIBaseForm:=20=E5=A2=9E=E5=8A=A0=E5=B1=9E?= =?UTF-8?q?=E6=80=A7IconImage=EF=BC=8C=E4=BB=A5=E6=94=B9=E5=96=84Icon?= =?UTF-8?q?=E8=BD=ACImage=E6=98=BE=E7=A4=BA=E4=B8=8D=E4=BD=B3=EF=BC=8C?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=A0=8F=E6=98=BE=E7=A4=BA=E4=BB=8D=E7=84=B6?= =?UTF-8?q?=E7=94=A8Icon=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Controls/UICalendar.cs | 9 ------- SunnyUI/Controls/UIColorPicker.cs | 1 - SunnyUI/Controls/UIComboBox.Designer.cs | 1 - SunnyUI/Controls/UIComboDataGridView.cs | 1 - SunnyUI/Controls/UIComboTreeView.cs | 1 - SunnyUI/Controls/UIControl.cs | 6 ++--- SunnyUI/Controls/UIDatePicker.Designer.cs | 1 - SunnyUI/Controls/UIDateTimePicker.cs | 1 - SunnyUI/Controls/UIDoubleUpDown.designer.cs | 4 ---- SunnyUI/Controls/UIFlowLayoutPanel.cs | 3 --- SunnyUI/Controls/UIIPTextBox.cs | 1 - SunnyUI/Controls/UIImageButton.cs | 6 ++--- SunnyUI/Controls/UIIntegerUpDown.designer.cs | 4 ---- SunnyUI/Controls/UILabel.cs | 12 +++++----- SunnyUI/Controls/UIMiniPagination.cs | 2 -- SunnyUI/Controls/UINumPadTextBox.cs | 1 - SunnyUI/Controls/UIPagination.cs | 6 ----- SunnyUI/Controls/UIRichTextBox.cs | 2 -- SunnyUI/Controls/UISmoothLabel.cs | 6 ++--- SunnyUI/Controls/UITextBox.Designer.cs | 1 - SunnyUI/Controls/UITextBox.cs | 2 -- SunnyUI/Controls/UITimePicker.cs | 1 - SunnyUI/Controls/UITransfer.Designer.cs | 7 ------ SunnyUI/Controls/UITreeView.cs | 2 -- SunnyUI/Controls/UIUserControl.cs | 6 ++--- SunnyUI/Forms/UIBaseForm.cs | 13 ++++++---- SunnyUI/Forms/UIEditForm.Designer.cs | 2 -- SunnyUI/Forms/UIForm.cs | 11 +++++++-- SunnyUI/Forms/UIForm2.cs | 11 +++++++-- SunnyUI/Forms/UIInputForm.Designer.cs | 1 - SunnyUI/Forms/UILoginForm.Designer.cs | 1 - SunnyUI/Forms/UIMessageForm.Designer.cs | 1 - SunnyUI/Forms/UIMessageForm2.Designer.cs | 1 - .../Forms/UIProcessIndicatorForm.Designer.cs | 1 - SunnyUI/Forms/UISelectForm.Designer.cs | 1 - SunnyUI/Forms/UIStatusForm.Designer.cs | 1 - SunnyUI/Forms/UIWaitForm.designer.cs | 1 - SunnyUI/Frames/UIPage.cs | 8 +++---- SunnyUI/Style/UTranslate.cs | 24 ++++++++++++------- 39 files changed, 65 insertions(+), 99 deletions(-) diff --git a/SunnyUI/Controls/UICalendar.cs b/SunnyUI/Controls/UICalendar.cs index 60ada0da..c3256a13 100644 --- a/SunnyUI/Controls/UICalendar.cs +++ b/SunnyUI/Controls/UICalendar.cs @@ -98,7 +98,6 @@ namespace Sunny.UI TopPanel.Name = "TopPanel"; TopPanel.RadiusSides = UICornerRadiusSides.None; TopPanel.RectSides = ToolStripStatusLabelBorderSides.Left | ToolStripStatusLabelBorderSides.Top | ToolStripStatusLabelBorderSides.Right; - TopPanel.ShowBuiltInResources = true; TopPanel.Size = new Size(461, 31); TopPanel.TabIndex = 0; TopPanel.Text = "2020-05-05"; @@ -117,7 +116,6 @@ namespace Sunny.UI b4.Padding = new Padding(24, 0, 0, 0); b4.RadiusSides = UICornerRadiusSides.None; b4.RectSides = ToolStripStatusLabelBorderSides.None; - b4.ShowBuiltInResources = true; b4.Size = new Size(30, 24); b4.Style = UIStyle.Custom; b4.Symbol = 61697; @@ -137,7 +135,6 @@ namespace Sunny.UI b3.Padding = new Padding(24, 0, 0, 0); b3.RadiusSides = UICornerRadiusSides.None; b3.RectSides = ToolStripStatusLabelBorderSides.None; - b3.ShowBuiltInResources = true; b3.Size = new Size(30, 24); b3.Style = UIStyle.Custom; b3.Symbol = 61701; @@ -156,7 +153,6 @@ namespace Sunny.UI b2.Padding = new Padding(24, 0, 0, 0); b2.RadiusSides = UICornerRadiusSides.None; b2.RectSides = ToolStripStatusLabelBorderSides.None; - b2.ShowBuiltInResources = true; b2.Size = new Size(30, 24); b2.Style = UIStyle.Custom; b2.Symbol = 61700; @@ -175,7 +171,6 @@ namespace Sunny.UI b1.Padding = new Padding(24, 0, 0, 0); b1.RadiusSides = UICornerRadiusSides.None; b1.RectSides = ToolStripStatusLabelBorderSides.None; - b1.ShowBuiltInResources = true; b1.Size = new Size(30, 24); b1.Style = UIStyle.Custom; b1.Symbol = 61696; @@ -223,7 +218,6 @@ namespace Sunny.UI p1.MinimumSize = new Size(1, 1); p1.Name = "p1"; p1.RadiusSides = UICornerRadiusSides.None; - p1.ShowBuiltInResources = true; p1.Size = new Size(461, 277); p1.TabIndex = 0; p1.Text = null; @@ -253,7 +247,6 @@ namespace Sunny.UI p2.MinimumSize = new Size(1, 1); p2.Name = "p2"; p2.RadiusSides = UICornerRadiusSides.None; - p2.ShowBuiltInResources = true; p2.Size = new Size(461, 277); p2.TabIndex = 1; p2.Text = null; @@ -283,7 +276,6 @@ namespace Sunny.UI p3.MinimumSize = new Size(1, 1); p3.Name = "p3"; p3.RadiusSides = UICornerRadiusSides.None; - p3.ShowBuiltInResources = true; p3.Size = new Size(461, 277); p3.TabIndex = 2; p3.Text = null; @@ -299,7 +291,6 @@ namespace Sunny.UI Controls.Add(TopPanel); FillColor = Color.White; Name = "UICalendar"; - ShowBuiltInResources = true; Size = new Size(461, 348); TopPanel.ResumeLayout(false); TabControl.ResumeLayout(false); diff --git a/SunnyUI/Controls/UIColorPicker.cs b/SunnyUI/Controls/UIColorPicker.cs index 102f2046..81dce89e 100644 --- a/SunnyUI/Controls/UIColorPicker.cs +++ b/SunnyUI/Controls/UIColorPicker.cs @@ -50,7 +50,6 @@ namespace Sunny.UI // DropDownStyle = UIDropDownStyle.DropDownList; Name = "UIColorPicker"; - ShowBuiltInResources = true; ButtonClick += UIColorPicker_ButtonClick; ResumeLayout(false); PerformLayout(); diff --git a/SunnyUI/Controls/UIComboBox.Designer.cs b/SunnyUI/Controls/UIComboBox.Designer.cs index 3e120a25..bb148e6e 100644 --- a/SunnyUI/Controls/UIComboBox.Designer.cs +++ b/SunnyUI/Controls/UIComboBox.Designer.cs @@ -43,7 +43,6 @@ // AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; Name = "UIComboBox"; - ShowBuiltInResources = true; KeyDown += UIComboBox_KeyDown; ButtonClick += UIComboBox_ButtonClick; FontChanged += UIComboBox_FontChanged; diff --git a/SunnyUI/Controls/UIComboDataGridView.cs b/SunnyUI/Controls/UIComboDataGridView.cs index cc4d38d9..643ea166 100644 --- a/SunnyUI/Controls/UIComboDataGridView.cs +++ b/SunnyUI/Controls/UIComboDataGridView.cs @@ -52,7 +52,6 @@ namespace Sunny.UI // DropDownStyle = UIDropDownStyle.DropDownList; Name = "UIComboDataGridView"; - ShowBuiltInResources = true; ButtonClick += UIComboDataGridView_ButtonClick; ResumeLayout(false); PerformLayout(); diff --git a/SunnyUI/Controls/UIComboTreeView.cs b/SunnyUI/Controls/UIComboTreeView.cs index 2aac043c..03cd128d 100644 --- a/SunnyUI/Controls/UIComboTreeView.cs +++ b/SunnyUI/Controls/UIComboTreeView.cs @@ -59,7 +59,6 @@ namespace Sunny.UI // DropDownStyle = UIDropDownStyle.DropDownList; Name = "UIComboTreeView"; - ShowBuiltInResources = true; ButtonClick += UIComboTreeView_ButtonClick; ResumeLayout(false); PerformLayout(); diff --git a/SunnyUI/Controls/UIControl.cs b/SunnyUI/Controls/UIControl.cs index 89b02e6a..c295585e 100644 --- a/SunnyUI/Controls/UIControl.cs +++ b/SunnyUI/Controls/UIControl.cs @@ -58,9 +58,9 @@ namespace Sunny.UI [Description("控件在界面显示时需要多语翻译的属性名称数组"), Category("SunnyUI")] public virtual string[] FormTranslatorProperties { get; } - [DefaultValue(false)] - [Description("控件是否显示多语内置资源"), Category("SunnyUI")] - public bool ShowBuiltInResources { get; set; } = false; + [DefaultValue(true)] + [Description("控件在界面显示时需要多语翻译"), Category("SunnyUI")] + public bool MultiLanguageSupport { get; set; } = true; [Browsable(false)] public bool Disabled => !Enabled; diff --git a/SunnyUI/Controls/UIDatePicker.Designer.cs b/SunnyUI/Controls/UIDatePicker.Designer.cs index 82683e1e..63c6d8e3 100644 --- a/SunnyUI/Controls/UIDatePicker.Designer.cs +++ b/SunnyUI/Controls/UIDatePicker.Designer.cs @@ -36,7 +36,6 @@ // AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; Name = "UIDatePicker"; - ShowBuiltInResources = true; SymbolDropDown = 61555; SymbolNormal = 61555; ButtonClick += UIDatetimePicker_ButtonClick; diff --git a/SunnyUI/Controls/UIDateTimePicker.cs b/SunnyUI/Controls/UIDateTimePicker.cs index c7145a3c..aed5537f 100644 --- a/SunnyUI/Controls/UIDateTimePicker.cs +++ b/SunnyUI/Controls/UIDateTimePicker.cs @@ -46,7 +46,6 @@ namespace Sunny.UI // UIDatetimePicker // Name = "UIDatetimePicker"; - ShowBuiltInResources = true; SymbolDropDown = 61555; SymbolNormal = 61555; ButtonClick += UIDatetimePicker_ButtonClick; diff --git a/SunnyUI/Controls/UIDoubleUpDown.designer.cs b/SunnyUI/Controls/UIDoubleUpDown.designer.cs index a73445b0..23010f2e 100644 --- a/SunnyUI/Controls/UIDoubleUpDown.designer.cs +++ b/SunnyUI/Controls/UIDoubleUpDown.designer.cs @@ -45,7 +45,6 @@ btnDec.Name = "btnDec"; btnDec.Padding = new System.Windows.Forms.Padding(26, 4, 0, 0); btnDec.RadiusSides = UICornerRadiusSides.LeftTop | UICornerRadiusSides.LeftBottom; - btnDec.ShowBuiltInResources = true; btnDec.Size = new System.Drawing.Size(29, 29); btnDec.Symbol = 61544; btnDec.TabIndex = 0; @@ -65,7 +64,6 @@ btnAdd.Name = "btnAdd"; btnAdd.Padding = new System.Windows.Forms.Padding(26, 3, 0, 0); btnAdd.RadiusSides = UICornerRadiusSides.RightTop | UICornerRadiusSides.RightBottom; - btnAdd.ShowBuiltInResources = true; btnAdd.Size = new System.Drawing.Size(29, 29); btnAdd.Symbol = 61543; btnAdd.TabIndex = 1; @@ -83,7 +81,6 @@ pnlValue.Name = "pnlValue"; pnlValue.RadiusSides = UICornerRadiusSides.None; pnlValue.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Top | System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom; - pnlValue.ShowBuiltInResources = true; pnlValue.Size = new System.Drawing.Size(58, 29); pnlValue.TabIndex = 2; pnlValue.Text = "0"; @@ -98,7 +95,6 @@ Controls.Add(btnDec); MinimumSize = new System.Drawing.Size(100, 0); Name = "UIDoubleUpDown"; - ShowBuiltInResources = true; Size = new System.Drawing.Size(116, 29); ResumeLayout(false); } diff --git a/SunnyUI/Controls/UIFlowLayoutPanel.cs b/SunnyUI/Controls/UIFlowLayoutPanel.cs index c902cdb8..4d6dd09a 100644 --- a/SunnyUI/Controls/UIFlowLayoutPanel.cs +++ b/SunnyUI/Controls/UIFlowLayoutPanel.cs @@ -538,7 +538,6 @@ namespace Sunny.UI VBar.Location = new Point(410, 5); VBar.MinimumSize = new Size(1, 1); VBar.Name = "VBar"; - VBar.ShowBuiltInResources = true; VBar.Size = new Size(18, 377); VBar.TabIndex = 1; VBar.TagString = "63FD1249-41D3-E08A-F8F5-CC41CC30FD03"; @@ -551,7 +550,6 @@ namespace Sunny.UI HBar.Location = new Point(5, 364); HBar.MinimumSize = new Size(1, 1); HBar.Name = "HBar"; - HBar.ShowBuiltInResources = true; HBar.Size = new Size(399, 18); HBar.TabIndex = 2; HBar.TagString = "79E1E7DD-3E4D-916B-C8F1-F45B579C290C"; @@ -565,7 +563,6 @@ namespace Sunny.UI Controls.Add(flowLayoutPanel); Name = "UIFlowLayoutPanel"; Padding = new Padding(2); - ShowBuiltInResources = true; Size = new Size(433, 387); ResumeLayout(false); } diff --git a/SunnyUI/Controls/UIIPTextBox.cs b/SunnyUI/Controls/UIIPTextBox.cs index 56b40ab6..1642c9ec 100644 --- a/SunnyUI/Controls/UIIPTextBox.cs +++ b/SunnyUI/Controls/UIIPTextBox.cs @@ -422,7 +422,6 @@ namespace Sunny.UI FillColor2 = Color.FromArgb(235, 243, 255); Name = "UIIPTextBox"; Padding = new Padding(1); - ShowBuiltInResources = true; Size = new Size(219, 29); SizeChanged += UIIPTextBox_SizeChanged; ResumeLayout(false); diff --git a/SunnyUI/Controls/UIImageButton.cs b/SunnyUI/Controls/UIImageButton.cs index bf2096dd..36d391e2 100644 --- a/SunnyUI/Controls/UIImageButton.cs +++ b/SunnyUI/Controls/UIImageButton.cs @@ -52,9 +52,9 @@ namespace Sunny.UI [Description("控件在界面显示时需要多语翻译的属性名称数组"), Category("SunnyUI")] public string[] FormTranslatorProperties => ["Text"]; - [DefaultValue(false)] - [Description("控件是否显示多语内置资源"), Category("SunnyUI")] - public bool ShowBuiltInResources { get; set; } = false; + [DefaultValue(true)] + [Description("控件在界面显示时需要多语翻译"), Category("SunnyUI")] + public bool MultiLanguageSupport { get; set; } = true; /// diff --git a/SunnyUI/Controls/UIIntegerUpDown.designer.cs b/SunnyUI/Controls/UIIntegerUpDown.designer.cs index fac3a457..70afbb02 100644 --- a/SunnyUI/Controls/UIIntegerUpDown.designer.cs +++ b/SunnyUI/Controls/UIIntegerUpDown.designer.cs @@ -45,7 +45,6 @@ btnDec.Name = "btnDec"; btnDec.Padding = new System.Windows.Forms.Padding(26, 4, 0, 0); btnDec.RadiusSides = UICornerRadiusSides.LeftTop | UICornerRadiusSides.LeftBottom; - btnDec.ShowBuiltInResources = true; btnDec.Size = new System.Drawing.Size(29, 29); btnDec.Symbol = 61544; btnDec.TabIndex = 0; @@ -65,7 +64,6 @@ btnAdd.Name = "btnAdd"; btnAdd.Padding = new System.Windows.Forms.Padding(26, 3, 0, 0); btnAdd.RadiusSides = UICornerRadiusSides.RightTop | UICornerRadiusSides.RightBottom; - btnAdd.ShowBuiltInResources = true; btnAdd.Size = new System.Drawing.Size(29, 29); btnAdd.Symbol = 61543; btnAdd.TabIndex = 1; @@ -83,7 +81,6 @@ pnlValue.Name = "pnlValue"; pnlValue.RadiusSides = UICornerRadiusSides.None; pnlValue.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Top | System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom; - pnlValue.ShowBuiltInResources = true; pnlValue.Size = new System.Drawing.Size(58, 29); pnlValue.TabIndex = 2; pnlValue.Text = "0"; @@ -98,7 +95,6 @@ Controls.Add(btnDec); MinimumSize = new System.Drawing.Size(100, 0); Name = "UIIntegerUpDown"; - ShowBuiltInResources = true; Size = new System.Drawing.Size(116, 29); ResumeLayout(false); } diff --git a/SunnyUI/Controls/UILabel.cs b/SunnyUI/Controls/UILabel.cs index 03808757..d3ae266c 100644 --- a/SunnyUI/Controls/UILabel.cs +++ b/SunnyUI/Controls/UILabel.cs @@ -47,9 +47,9 @@ namespace Sunny.UI [Description("控件在界面显示时需要多语翻译的属性名称数组"), Category("SunnyUI")] public string[] FormTranslatorProperties => ["Text"]; - [DefaultValue(false)] - [Description("控件是否显示多语内置资源"), Category("SunnyUI")] - public bool ShowBuiltInResources { get; set; } = false; + [DefaultValue(true)] + [Description("控件在界面显示时需要多语翻译"), Category("SunnyUI")] + public bool MultiLanguageSupport { get; set; } = true; /// /// 禁止控件跟随窗体缩放 @@ -186,9 +186,9 @@ namespace Sunny.UI [Description("控件在界面显示时需要多语翻译的属性名称数组"), Category("SunnyUI")] public string[] FormTranslatorProperties => ["Text"]; - [DefaultValue(false)] - [Description("控件是否显示多语内置资源"), Category("SunnyUI")] - public bool ShowBuiltInResources { get; set; } = false; + [DefaultValue(true)] + [Description("控件在界面显示时需要多语翻译"), Category("SunnyUI")] + public bool MultiLanguageSupport { get; set; } = true; /// /// 禁止控件跟随窗体缩放 diff --git a/SunnyUI/Controls/UIMiniPagination.cs b/SunnyUI/Controls/UIMiniPagination.cs index 8b8b7c3b..0c160e4f 100644 --- a/SunnyUI/Controls/UIMiniPagination.cs +++ b/SunnyUI/Controls/UIMiniPagination.cs @@ -109,7 +109,6 @@ namespace Sunny.UI buttons[i].MouseLeave += UIDataGridPage_MouseLeave; buttons[i].Click += UIDataGridPage_Click; buttons[i].Size = new System.Drawing.Size(32, 32); - buttons[i].ShowBuiltInResources = true; } buttonTags.TryAdd(b0, -1); @@ -600,7 +599,6 @@ namespace Sunny.UI Name = "UIMiniPagination"; RadiusSides = UICornerRadiusSides.None; RectSides = ToolStripStatusLabelBorderSides.None; - ShowBuiltInResources = true; Size = new Size(641, 40); ResumeLayout(false); } diff --git a/SunnyUI/Controls/UINumPadTextBox.cs b/SunnyUI/Controls/UINumPadTextBox.cs index b14089d9..4238b408 100644 --- a/SunnyUI/Controls/UINumPadTextBox.cs +++ b/SunnyUI/Controls/UINumPadTextBox.cs @@ -270,7 +270,6 @@ namespace Sunny.UI // UINumPadTextBox // Name = "UINumPadTextBox"; - ShowBuiltInResources = true; ButtonClick += UIKeyBoardTextBox_ButtonClick; ResumeLayout(false); PerformLayout(); diff --git a/SunnyUI/Controls/UIPagination.cs b/SunnyUI/Controls/UIPagination.cs index 7ef9d8f7..2d82ef10 100644 --- a/SunnyUI/Controls/UIPagination.cs +++ b/SunnyUI/Controls/UIPagination.cs @@ -114,7 +114,6 @@ 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); @@ -647,7 +646,6 @@ namespace Sunny.UI edtPage.MinimumSize = new Size(1, 1); edtPage.Name = "edtPage"; edtPage.Padding = new Padding(5); - edtPage.ShowBuiltInResources = true; edtPage.ShowText = false; edtPage.Size = new Size(53, 29); edtPage.TabIndex = 1; @@ -663,7 +661,6 @@ namespace Sunny.UI 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; @@ -679,7 +676,6 @@ namespace Sunny.UI uiLabel2.ForeColor = Color.FromArgb(48, 48, 48); uiLabel2.Location = new Point(726, 10); uiLabel2.Name = "uiLabel2"; - uiLabel2.ShowBuiltInResources = true; uiLabel2.Size = new Size(21, 14); uiLabel2.TabIndex = 2; uiLabel2.Text = "页"; @@ -693,7 +689,6 @@ namespace Sunny.UI uiLabel1.ForeColor = Color.FromArgb(48, 48, 48); uiLabel1.Location = new Point(650, 10); uiLabel1.Name = "uiLabel1"; - uiLabel1.ShowBuiltInResources = true; uiLabel1.Size = new Size(21, 14); uiLabel1.TabIndex = 0; uiLabel1.Text = "第"; @@ -724,7 +719,6 @@ namespace Sunny.UI Controls.Add(b0); Name = "UIPagination"; RectSides = ToolStripStatusLabelBorderSides.None; - ShowBuiltInResources = true; Size = new Size(1139, 35); ResumeLayout(false); PerformLayout(); diff --git a/SunnyUI/Controls/UIRichTextBox.cs b/SunnyUI/Controls/UIRichTextBox.cs index 2d1dccce..00c63ca0 100644 --- a/SunnyUI/Controls/UIRichTextBox.cs +++ b/SunnyUI/Controls/UIRichTextBox.cs @@ -530,7 +530,6 @@ namespace Sunny.UI bar.Location = new Point(247, 4); bar.MinimumSize = new Size(1, 1); bar.Name = "bar"; - bar.ShowBuiltInResources = true; bar.Size = new Size(19, 173); bar.TabIndex = 2; bar.Text = "uiScrollBar1"; @@ -542,7 +541,6 @@ namespace Sunny.UI FillColor = Color.White; Name = "UIRichTextBox"; Padding = new Padding(2); - ShowBuiltInResources = true; FontChanged += UIRichTextBox_FontChanged; SizeChanged += UIRichTextBox_SizeChanged; ResumeLayout(false); diff --git a/SunnyUI/Controls/UISmoothLabel.cs b/SunnyUI/Controls/UISmoothLabel.cs index cbcee821..5caf3577 100644 --- a/SunnyUI/Controls/UISmoothLabel.cs +++ b/SunnyUI/Controls/UISmoothLabel.cs @@ -59,9 +59,9 @@ namespace Sunny.UI [Description("控件在界面显示时需要多语翻译的属性名称数组"), Category("SunnyUI")] public string[] FormTranslatorProperties => ["Text"]; - [DefaultValue(false)] - [Description("控件是否显示多语内置资源"), Category("SunnyUI")] - public bool ShowBuiltInResources { get; set; } = false; + [DefaultValue(true)] + [Description("控件在界面显示时需要多语翻译"), Category("SunnyUI")] + public bool MultiLanguageSupport { get; set; } = true; protected override void Dispose(bool disposing) { diff --git a/SunnyUI/Controls/UITextBox.Designer.cs b/SunnyUI/Controls/UITextBox.Designer.cs index feb6f4d5..32e468e0 100644 --- a/SunnyUI/Controls/UITextBox.Designer.cs +++ b/SunnyUI/Controls/UITextBox.Designer.cs @@ -41,7 +41,6 @@ Cursor = System.Windows.Forms.Cursors.IBeam; Name = "UITextBox"; Padding = new System.Windows.Forms.Padding(5); - ShowBuiltInResources = true; Size = new System.Drawing.Size(250, 29); ResumeLayout(false); } diff --git a/SunnyUI/Controls/UITextBox.cs b/SunnyUI/Controls/UITextBox.cs index 5e90dd13..00079248 100644 --- a/SunnyUI/Controls/UITextBox.cs +++ b/SunnyUI/Controls/UITextBox.cs @@ -131,7 +131,6 @@ namespace Sunny.UI btn.Click += Btn_Click; btn.Radius = 3; btn.SymbolOffset = new Point(-1, 1); - btn.ShowBuiltInResources = true; edit.Invalidate(); Controls.Add(edit); @@ -142,7 +141,6 @@ namespace Sunny.UI bar.Visible = false; bar.ValueChanged += Bar_ValueChanged; bar.MouseEnter += Bar_MouseEnter; - bar.ShowBuiltInResources = true; TextAlignment = ContentAlignment.MiddleLeft; lastEditHeight = edit.Height; diff --git a/SunnyUI/Controls/UITimePicker.cs b/SunnyUI/Controls/UITimePicker.cs index a2568f9d..906a08c7 100644 --- a/SunnyUI/Controls/UITimePicker.cs +++ b/SunnyUI/Controls/UITimePicker.cs @@ -41,7 +41,6 @@ namespace Sunny.UI // UITimePicker // Name = "UITimePicker"; - ShowBuiltInResources = true; SymbolDropDown = 61555; SymbolNormal = 61555; ButtonClick += UITimePicker_ButtonClick; diff --git a/SunnyUI/Controls/UITransfer.Designer.cs b/SunnyUI/Controls/UITransfer.Designer.cs index 5c059fb7..cd7226f8 100644 --- a/SunnyUI/Controls/UITransfer.Designer.cs +++ b/SunnyUI/Controls/UITransfer.Designer.cs @@ -48,7 +48,6 @@ namespace Sunny.UI b1.MinimumSize = new System.Drawing.Size(1, 1); b1.Name = "b1"; b1.Padding = new Padding(28, 0, 0, 0); - b1.ShowBuiltInResources = true; b1.Size = new System.Drawing.Size(44, 32); b1.Symbol = 61697; b1.TabIndex = 3; @@ -66,7 +65,6 @@ namespace Sunny.UI b2.MinimumSize = new System.Drawing.Size(1, 1); b2.Name = "b2"; b2.Padding = new Padding(28, 0, 0, 0); - b2.ShowBuiltInResources = true; b2.Size = new System.Drawing.Size(44, 32); b2.Symbol = 61701; b2.TabIndex = 4; @@ -84,7 +82,6 @@ namespace Sunny.UI b3.MinimumSize = new System.Drawing.Size(1, 1); b3.Name = "b3"; b3.Padding = new Padding(28, 0, 0, 0); - b3.ShowBuiltInResources = true; b3.Size = new System.Drawing.Size(44, 32); b3.Symbol = 61700; b3.TabIndex = 5; @@ -102,7 +99,6 @@ namespace Sunny.UI b4.MinimumSize = new System.Drawing.Size(1, 1); b4.Name = "b4"; b4.Padding = new Padding(28, 0, 0, 0); - b4.ShowBuiltInResources = true; b4.Size = new System.Drawing.Size(44, 32); b4.Symbol = 61696; b4.TabIndex = 6; @@ -124,7 +120,6 @@ namespace Sunny.UI l1.Name = "l1"; l1.Padding = new Padding(2); l1.SelectionMode = SelectionMode.MultiExtended; - l1.ShowBuiltInResources = true; l1.ShowText = false; l1.Size = new System.Drawing.Size(210, 348); l1.TabIndex = 7; @@ -146,7 +141,6 @@ namespace Sunny.UI l2.Name = "l2"; l2.Padding = new Padding(2); l2.SelectionMode = SelectionMode.MultiExtended; - l2.ShowBuiltInResources = true; l2.ShowText = false; l2.Size = new System.Drawing.Size(210, 348); l2.TabIndex = 8; @@ -168,7 +162,6 @@ namespace Sunny.UI Padding = new Padding(1); RadiusSides = UICornerRadiusSides.None; RectSides = ToolStripStatusLabelBorderSides.None; - ShowBuiltInResources = true; Size = new System.Drawing.Size(500, 350); ResumeLayout(false); } diff --git a/SunnyUI/Controls/UITreeView.cs b/SunnyUI/Controls/UITreeView.cs index 3d19df3d..7aedfeef 100644 --- a/SunnyUI/Controls/UITreeView.cs +++ b/SunnyUI/Controls/UITreeView.cs @@ -958,7 +958,6 @@ namespace Sunny.UI Bar.Location = new Point(247, 3); Bar.MinimumSize = new Size(1, 1); Bar.Name = "Bar"; - Bar.ShowBuiltInResources = true; Bar.Size = new Size(19, 173); Bar.Style = UIStyle.Custom; Bar.StyleCustomMode = true; @@ -986,7 +985,6 @@ namespace Sunny.UI Controls.Add(view); FillColor = Color.White; Name = "UITreeView"; - ShowBuiltInResources = true; ResumeLayout(false); } diff --git a/SunnyUI/Controls/UIUserControl.cs b/SunnyUI/Controls/UIUserControl.cs index e8907aaa..dd453659 100644 --- a/SunnyUI/Controls/UIUserControl.cs +++ b/SunnyUI/Controls/UIUserControl.cs @@ -58,9 +58,9 @@ namespace Sunny.UI [Description("控件在界面显示时需要多语翻译的属性名称数组"), Category("SunnyUI")] public virtual string[] FormTranslatorProperties { get; } - [DefaultValue(false)] - [Description("控件是否显示多语内置资源"), Category("SunnyUI")] - public bool ShowBuiltInResources { get; set; } = false; + [DefaultValue(true)] + [Description("控件在界面显示时需要多语翻译"), Category("SunnyUI")] + public bool MultiLanguageSupport { get; set; } = true; protected override void OnClick(EventArgs e) { diff --git a/SunnyUI/Forms/UIBaseForm.cs b/SunnyUI/Forms/UIBaseForm.cs index 8cfa01a1..1eb65603 100644 --- a/SunnyUI/Forms/UIBaseForm.cs +++ b/SunnyUI/Forms/UIBaseForm.cs @@ -18,6 +18,7 @@ * * 2024-04-29: V3.6.5 增加文件说明 * 2024-04-29: V3.6.5 删除ShowTitleIcon,默认使用ShowIcon + * 2024-10-05: V3.7.0 增加属性IconImage,以改善Icon转Image显示不佳,状态栏显示仍然用Icon属性 ******************************************************************************/ using System; @@ -152,7 +153,7 @@ namespace Sunny.UI if (UIStyles.Style.IsValid()) SetInheritedStyle(UIStyles.Style); - if (!ShowBuiltInResources) + if (UIStyles.MultiLanguageSupport) Translate(); } @@ -202,6 +203,10 @@ namespace Sunny.UI return image; } + [Description("标题栏图标图片,状态栏显示仍然用Icon属性"), Category("SunnyUI")] + [DefaultValue(null)] + public Image IconImage { get; set; } + private StringAlignment textAlignment = StringAlignment.Near; [Description("文字对齐方式"), Category("SunnyUI")] @@ -1066,9 +1071,9 @@ namespace Sunny.UI #endregion IFrame实现 - [DefaultValue(false)] - [Description("控件是否显示多语内置资源"), Category("SunnyUI")] - public bool ShowBuiltInResources { get; set; } = false; + [DefaultValue(true)] + [Description("控件在界面显示时需要多语翻译"), Category("SunnyUI")] + public bool MultiLanguageSupport { get; set; } = true; public virtual void Translate() { diff --git a/SunnyUI/Forms/UIEditForm.Designer.cs b/SunnyUI/Forms/UIEditForm.Designer.cs index e057e659..cada6d5e 100644 --- a/SunnyUI/Forms/UIEditForm.Designer.cs +++ b/SunnyUI/Forms/UIEditForm.Designer.cs @@ -62,7 +62,6 @@ btnCancel.MinimumSize = new System.Drawing.Size(1, 1); btnCancel.Name = "btnCancel"; btnCancel.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); - btnCancel.ShowBuiltInResources = true; btnCancel.ShowFocusColor = true; btnCancel.Size = new System.Drawing.Size(100, 35); btnCancel.Symbol = 361453; @@ -82,7 +81,6 @@ btnOK.MinimumSize = new System.Drawing.Size(1, 1); btnOK.Name = "btnOK"; btnOK.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); - btnOK.ShowBuiltInResources = true; btnOK.ShowFocusColor = true; btnOK.Size = new System.Drawing.Size(100, 35); btnOK.TabIndex = 0; diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index f8861627..d642c780 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -562,9 +562,16 @@ namespace Sunny.UI { try { - using (Image image = IconToImage(Icon)) + if (IconImage != null) { - e.Graphics.DrawImage(image, 6, (TitleHeight - 24) / 2 + 1, 24, 24); + e.Graphics.DrawImage(IconImage, new Rectangle(6, (TitleHeight - 24) / 2 + 1, 24, 24), new Rectangle(0, 0, IconImage.Width, IconImage.Height), GraphicsUnit.Pixel); + } + else + { + using (Image image = IconToImage(Icon)) + { + e.Graphics.DrawImage(image, 6, (TitleHeight - 24) / 2 + 1, 24, 24); + } } } catch diff --git a/SunnyUI/Forms/UIForm2.cs b/SunnyUI/Forms/UIForm2.cs index 2315f7a6..9a958d22 100644 --- a/SunnyUI/Forms/UIForm2.cs +++ b/SunnyUI/Forms/UIForm2.cs @@ -165,9 +165,16 @@ namespace Sunny.UI { try { - using (Image image = IconToImage(Icon)) + if (IconImage != null) { - e.Graphics.DrawImage(image, 6, (TitleHeight - 24) / 2 + 1, 24, 24); + e.Graphics.DrawImage(IconImage, new Rectangle(6, (TitleHeight - 24) / 2 + 1, 24, 24), new Rectangle(0, 0, IconImage.Width, IconImage.Height), GraphicsUnit.Pixel); + } + else + { + using (Image image = IconToImage(Icon)) + { + e.Graphics.DrawImage(image, 6, (TitleHeight - 24) / 2 + 1, 24, 24); + } } } catch diff --git a/SunnyUI/Forms/UIInputForm.Designer.cs b/SunnyUI/Forms/UIInputForm.Designer.cs index f639773c..e27a3c06 100644 --- a/SunnyUI/Forms/UIInputForm.Designer.cs +++ b/SunnyUI/Forms/UIInputForm.Designer.cs @@ -90,7 +90,6 @@ Controls.Add(label); Name = "UIInputForm"; Padding = new System.Windows.Forms.Padding(0, 35, 0, 0); - ShowBuiltInResources = true; Style = UIStyle.Custom; Text = "输入"; ZoomScaleRect = new System.Drawing.Rectangle(15, 15, 473, 182); diff --git a/SunnyUI/Forms/UILoginForm.Designer.cs b/SunnyUI/Forms/UILoginForm.Designer.cs index a3d36503..c24b2c7e 100644 --- a/SunnyUI/Forms/UILoginForm.Designer.cs +++ b/SunnyUI/Forms/UILoginForm.Designer.cs @@ -209,7 +209,6 @@ MinimumSize = new System.Drawing.Size(750, 450); Name = "UILoginForm"; Padding = new System.Windows.Forms.Padding(0); - ShowBuiltInResources = true; ShowIcon = false; ShowInTaskbar = false; ShowTitle = false; diff --git a/SunnyUI/Forms/UIMessageForm.Designer.cs b/SunnyUI/Forms/UIMessageForm.Designer.cs index 77eca3c7..42627def 100644 --- a/SunnyUI/Forms/UIMessageForm.Designer.cs +++ b/SunnyUI/Forms/UIMessageForm.Designer.cs @@ -104,7 +104,6 @@ MaximizeBox = false; MinimizeBox = false; Name = "UIMessageForm"; - ShowBuiltInResources = true; ShowIcon = false; ShowInTaskbar = false; Text = "UIMsgBox"; diff --git a/SunnyUI/Forms/UIMessageForm2.Designer.cs b/SunnyUI/Forms/UIMessageForm2.Designer.cs index 789807ae..c83aa12e 100644 --- a/SunnyUI/Forms/UIMessageForm2.Designer.cs +++ b/SunnyUI/Forms/UIMessageForm2.Designer.cs @@ -88,7 +88,6 @@ MaximizeBox = false; MinimizeBox = false; Name = "UIMessageForm2"; - ShowBuiltInResources = true; ShowIcon = false; ShowInTaskbar = false; StartPosition = System.Windows.Forms.FormStartPosition.Manual; diff --git a/SunnyUI/Forms/UIProcessIndicatorForm.Designer.cs b/SunnyUI/Forms/UIProcessIndicatorForm.Designer.cs index d085da71..9c484e37 100644 --- a/SunnyUI/Forms/UIProcessIndicatorForm.Designer.cs +++ b/SunnyUI/Forms/UIProcessIndicatorForm.Designer.cs @@ -53,7 +53,6 @@ Controls.Add(uiProgressIndicator1); Name = "UIProcessIndicatorForm"; Padding = new System.Windows.Forms.Padding(2, 0, 2, 2); - ShowBuiltInResources = true; ShowTitle = false; Text = "UIProcessIndicatorForm"; ZoomScaleRect = new System.Drawing.Rectangle(15, 15, 800, 450); diff --git a/SunnyUI/Forms/UISelectForm.Designer.cs b/SunnyUI/Forms/UISelectForm.Designer.cs index 2a476eca..5c95afd9 100644 --- a/SunnyUI/Forms/UISelectForm.Designer.cs +++ b/SunnyUI/Forms/UISelectForm.Designer.cs @@ -87,7 +87,6 @@ Controls.Add(ComboBox); Name = "UISelectForm"; Padding = new System.Windows.Forms.Padding(1, 35, 1, 1); - ShowBuiltInResources = true; Text = "选择"; ZoomScaleRect = new System.Drawing.Rectangle(15, 15, 473, 182); Controls.SetChildIndex(ComboBox, 0); diff --git a/SunnyUI/Forms/UIStatusForm.Designer.cs b/SunnyUI/Forms/UIStatusForm.Designer.cs index 342b6968..bcac8308 100644 --- a/SunnyUI/Forms/UIStatusForm.Designer.cs +++ b/SunnyUI/Forms/UIStatusForm.Designer.cs @@ -75,7 +75,6 @@ MaximizeBox = false; MinimizeBox = false; Name = "UIStatusForm"; - ShowBuiltInResources = true; ShowIcon = false; Text = "提示"; TopMost = true; diff --git a/SunnyUI/Forms/UIWaitForm.designer.cs b/SunnyUI/Forms/UIWaitForm.designer.cs index 85b60723..e3a19f9b 100644 --- a/SunnyUI/Forms/UIWaitForm.designer.cs +++ b/SunnyUI/Forms/UIWaitForm.designer.cs @@ -69,7 +69,6 @@ MaximizeBox = false; MinimizeBox = false; Name = "UIWaitForm"; - ShowBuiltInResources = true; ShowIcon = false; Text = "提示"; TopMost = true; diff --git a/SunnyUI/Frames/UIPage.cs b/SunnyUI/Frames/UIPage.cs index ad66bf0e..10a6719c 100644 --- a/SunnyUI/Frames/UIPage.cs +++ b/SunnyUI/Frames/UIPage.cs @@ -305,7 +305,7 @@ namespace Sunny.UI if (UIStyles.Style.IsValid()) SetInheritedStyle(UIStyles.Style); - if (!ShowBuiltInResources) + if (UIStyles.MultiLanguageSupport) Translate(); } @@ -1152,8 +1152,8 @@ namespace Sunny.UI this.TranslateOther(); } - [DefaultValue(false)] - [Description("控件是否显示多语内置资源"), Category("SunnyUI")] - public bool ShowBuiltInResources { get; set; } = false; + [DefaultValue(true)] + [Description("控件在界面显示时需要多语翻译"), Category("SunnyUI")] + public bool MultiLanguageSupport { get; set; } = true; } } \ No newline at end of file diff --git a/SunnyUI/Style/UTranslate.cs b/SunnyUI/Style/UTranslate.cs index 8a8df271..f5c6ae1d 100644 --- a/SunnyUI/Style/UTranslate.cs +++ b/SunnyUI/Style/UTranslate.cs @@ -49,7 +49,7 @@ namespace Sunny.UI { string[] FormTranslatorProperties { get; } - bool ShowBuiltInResources { get; set; } + bool MultiLanguageSupport { get; set; } } public static class TranslateHelper @@ -77,10 +77,10 @@ namespace Sunny.UI "UISymbolLabel", "UITimePicker", "UITurnSwitch", - "UITitlePanel"//, + "UITitlePanel", //Native Controls //"Button", - //"ToolStripMenuItem", + "ToolStripMenuItem"//, //"CheckBox", //"RadioButton", //"GroupBox", @@ -184,8 +184,14 @@ namespace Sunny.UI const string warning = "注意:请先关闭应用程序,然后再修改此文档。否则修改可能会应用程序生成代码覆盖。"; if (ini.Read(section, "Warning", "") != warning) ini.Write(section, "Warning", warning); - ini.Write(section, "Controls", string.Join(";", names.ToArray())); ini.UpdateFile(); + + ini.EraseSection("Controls"); + ini.Write("Controls", "Count", names.Count); + for (int i = 0; i < names.Count; i++) + { + ini.Write("Controls", "Control" + i, names[i]); + } } } } @@ -208,8 +214,8 @@ namespace Sunny.UI string inifile = Dir.CurrentDir() + "Language\\" + thisFullName + ".ini"; if (!File.Exists(inifile)) return; IniFile ini = new IniFile(Dir.CurrentDir() + "Language\\" + thisFullName + ".ini", System.Text.Encoding.UTF8); - string controls = ini.Read(section, "Controls", ""); - if (controls.IsNullOrEmpty()) return; + int count = ini.ReadInt("Controls", "Count", 0); + if (count == 0) return; string key = UIStyles.CultureInfo.LCID.ToString() + ".DisplayName"; if (ini.Read(section, key, "") != UIStyles.CultureInfo.DisplayName) @@ -220,8 +226,10 @@ namespace Sunny.UI Dictionary Ctrls2 = new Dictionary(); Dictionary Ctrls3 = new Dictionary(); - foreach (var item in controls.Split(';')) + for (int i = 0; i < count; i++) { + string item = ini.Read("Controls", "Control" + i, ""); + if (item.IsNullOrEmpty()) continue; string[] strs = item.Split(","); if (strs.Length == 0) continue; @@ -240,7 +248,7 @@ namespace Sunny.UI section = UIStyles.CultureInfo.LCID + ".FormResources"; foreach (var control in formControls) { - if (control.ShowBuiltInResources) continue; + if (!control.MultiLanguageSupport) continue; Control ctrl = (Control)control; if (ctrl.Name.IsNullOrEmpty()) continue; if (Ctrls3.NotContainsKey(ctrl.Name)) continue;