* 重构多语翻译类

This commit is contained in:
Sunny 2024-09-14 22:05:03 +08:00
parent 98c7a8f81e
commit c0fbc85a76
7 changed files with 38 additions and 11 deletions

View File

@ -91,7 +91,7 @@ namespace Sunny.UI
TopPanel.Controls.Add(b2);
TopPanel.Controls.Add(b1);
TopPanel.Dock = DockStyle.Top;
TopPanel.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point);
TopPanel.Font = new Font("宋体", 12F);
TopPanel.Location = new Point(0, 0);
TopPanel.Margin = new Padding(4, 5, 4, 5);
TopPanel.MinimumSize = new Size(1, 1);
@ -109,17 +109,19 @@ namespace Sunny.UI
b4.Anchor = AnchorStyles.Top | AnchorStyles.Right;
b4.BackColor = Color.Transparent;
b4.Cursor = Cursors.Hand;
b4.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point);
b4.Font = new Font("宋体", 12F);
b4.Location = new Point(427, 4);
b4.MinimumSize = new Size(1, 1);
b4.Name = "b4";
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;
b4.TabIndex = 3;
b4.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
b4.Click += b4_Click;
//
// b3
@ -127,51 +129,57 @@ namespace Sunny.UI
b3.Anchor = AnchorStyles.Top | AnchorStyles.Right;
b3.BackColor = Color.Transparent;
b3.Cursor = Cursors.Hand;
b3.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point);
b3.Font = new Font("宋体", 12F);
b3.Location = new Point(391, 4);
b3.MinimumSize = new Size(1, 1);
b3.Name = "b3";
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;
b3.TabIndex = 2;
b3.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
b3.Click += b3_Click;
//
// b2
//
b2.BackColor = Color.Transparent;
b2.Cursor = Cursors.Hand;
b2.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point);
b2.Font = new Font("宋体", 12F);
b2.Location = new Point(40, 4);
b2.MinimumSize = new Size(1, 1);
b2.Name = "b2";
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;
b2.TabIndex = 1;
b2.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
b2.Click += b2_Click;
//
// b1
//
b1.BackColor = Color.Transparent;
b1.Cursor = Cursors.Hand;
b1.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point);
b1.Font = new Font("宋体", 12F);
b1.Location = new Point(4, 4);
b1.MinimumSize = new Size(1, 1);
b1.Name = "b1";
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;
b1.TabIndex = 0;
b1.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
b1.Click += b1_Click;
//
// TabControl
@ -181,7 +189,7 @@ namespace Sunny.UI
TabControl.Controls.Add(tabPage3);
TabControl.Dock = DockStyle.Fill;
TabControl.DrawMode = TabDrawMode.OwnerDrawFixed;
TabControl.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point);
TabControl.Font = new Font("宋体", 12F);
TabControl.ItemSize = new Size(150, 40);
TabControl.Location = new Point(0, 31);
TabControl.MainPage = "";
@ -191,6 +199,7 @@ namespace Sunny.UI
TabControl.SizeMode = TabSizeMode.Fixed;
TabControl.TabIndex = 1;
TabControl.TabUnSelectedForeColor = Color.FromArgb(240, 240, 240);
TabControl.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
TabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged;
//
// tabPage1
@ -207,7 +216,7 @@ namespace Sunny.UI
//
p1.Dock = DockStyle.Fill;
p1.FillColor = Color.White;
p1.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point);
p1.Font = new Font("宋体", 12F);
p1.Location = new Point(0, 0);
p1.Margin = new Padding(4, 5, 4, 5);
p1.MinimumSize = new Size(1, 1);
@ -236,7 +245,7 @@ namespace Sunny.UI
//
p2.Dock = DockStyle.Fill;
p2.FillColor = Color.White;
p2.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point);
p2.Font = new Font("宋体", 12F);
p2.Location = new Point(0, 0);
p2.Margin = new Padding(4, 5, 4, 5);
p2.MinimumSize = new Size(1, 1);
@ -265,7 +274,7 @@ namespace Sunny.UI
//
p3.Dock = DockStyle.Fill;
p3.FillColor = Color.White;
p3.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point);
p3.Font = new Font("宋体", 12F);
p3.Location = new Point(0, 0);
p3.Margin = new Padding(4, 5, 4, 5);
p3.MinimumSize = new Size(1, 1);

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Microsoft ResX Schema
Version 2.0
@ -48,7 +48,7 @@
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter

View File

@ -59,6 +59,9 @@ namespace Sunny.UI
fillColor = UIStyles.Blue.CheckBoxColor;
}
[Browsable(false)]
public override string[] FormTranslatorProperties => ["Text"];
/// <summary>
/// 重载绘图
/// </summary>

View File

@ -149,6 +149,8 @@ namespace Sunny.UI
{
SetInheritedStyle(UIStyles.Style);
}
Translate();
}
public virtual void SetInheritedStyle(UIStyle style)

View File

@ -303,6 +303,8 @@ namespace Sunny.UI
{
SetInheritedStyle(UIStyles.Style);
}
Translate();
}
private int _symbolSize = 24;

View File

@ -101,6 +101,14 @@ namespace Sunny.UI
set => UIStyles.GlobalRectangle = value;
}
[DefaultValue(false)]
[Description("多语言支持"), Category("SunnyUI")]
public bool MultiLanguageSupport
{
get => UIStyles.MultiLanguageSupport;
set => UIStyles.MultiLanguageSupport = value;
}
/// <summary>
/// 版本
/// </summary>

View File

@ -46,6 +46,9 @@ namespace Sunny.UI
public static bool GlobalRectangle { get; set; } = false;
/// <summary>
/// 多语言支持
/// </summary>
public static bool MultiLanguageSupport { get; set; } = false;
public static bool DPIScale { get; set; }