diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe index ab033e6f..926ec929 100644 Binary files a/Bin/net40/SunnyUI.Demo.exe and b/Bin/net40/SunnyUI.Demo.exe differ diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index a27d3d33..67a41440 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Charts/FLineChart.Designer.cs b/SunnyUI.Demo/Charts/FLineChart.Designer.cs index 0d297c71..5dbd306d 100644 --- a/SunnyUI.Demo/Charts/FLineChart.Designer.cs +++ b/SunnyUI.Demo/Charts/FLineChart.Designer.cs @@ -108,16 +108,13 @@ this.LineChart.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(54)))), ((int)(((byte)(54))))); this.LineChart.IsScaled = false; this.LineChart.LegendFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.LineChart.LegendFontSize = 9F; this.LineChart.Location = new System.Drawing.Point(30, 55); this.LineChart.MinimumSize = new System.Drawing.Size(1, 1); this.LineChart.Name = "LineChart"; this.LineChart.Size = new System.Drawing.Size(670, 430); this.LineChart.SubFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.LineChart.SubTextFontSize = 9F; this.LineChart.TabIndex = 35; this.LineChart.Text = "uiLineChart1"; - this.LineChart.TipsFontSize = 9F; this.LineChart.PointValue += new Sunny.UI.UILineChart.OnPointValue(this.LineChart_PointValue); // // uiSymbolButton2 diff --git a/SunnyUI/Charts/UIChart.cs b/SunnyUI/Charts/UIChart.cs index bc96bbf8..b821af19 100644 --- a/SunnyUI/Charts/UIChart.cs +++ b/SunnyUI/Charts/UIChart.cs @@ -39,8 +39,8 @@ namespace Sunny.UI Width = 400; Height = 300; - SubFont = UIFontColor.CreateSubFont(); - LegendFont = UIFontColor.CreateSubFont(); + SubFont = UIFontColor.SubFont(); + LegendFont = UIFontColor.SubFont(); tip.Parent = this; tip.Height = 32; @@ -49,7 +49,7 @@ namespace Sunny.UI tip.Top = 1; tip.StyleCustomMode = true; tip.Style = UIStyle.Custom; - tip.Font = UIFontColor.CreateSubFont(); + tip.Font = UIFontColor.SubFont(); tip.RadiusSides = UICornerRadiusSides.None; tip.Visible = false; @@ -64,7 +64,7 @@ namespace Sunny.UI private void Tip_VisibleChanged(object sender, EventArgs e) { tip.IsScaled = true; - float size = SubFont != null ? SubFont.Size : SubTextFontSize; + float size = SubFont != null ? SubFont.Size : UIFontColor.SubFontSize; tip.Font = this.DPIScaleFont(Font, size); } @@ -190,25 +190,13 @@ namespace Sunny.UI DrawOption(e.Graphics); } - [Category("SunnyUI")] - [DefaultValue(9), Browsable(false)] - public float LegendFontSize { get; set; } = 9; - - [Category("SunnyUI")] - [DefaultValue(9), Browsable(false)] - public float SubTextFontSize { get; set; } = 9; - - [Category("SunnyUI")] - [DefaultValue(9), Browsable(false)] - public float TipsFontSize { get; set; } = 9; - Font tmpFont; protected Font TempFont { get { - float size = SubFont != null ? SubFont.Size : SubTextFontSize; + float size = SubFont != null ? SubFont.Size : UIFontColor.SubFontSize; if (tmpFont == null || !tmpFont.Size.EqualsFloat(size / this.DPIScale())) { @@ -226,7 +214,7 @@ namespace Sunny.UI { get { - float size = LegendFont != null ? LegendFont.Size : LegendFontSize; + float size = LegendFont != null ? LegendFont.Size : UIFontColor.SubFontSize; if (tmpLegendFont == null || !tmpLegendFont.Size.EqualsFloat(size / this.DPIScale())) { diff --git a/SunnyUI/Common/UMessageTip.cs b/SunnyUI/Common/UMessageTip.cs index 5a0b0d2e..5484db60 100644 --- a/SunnyUI/Common/UMessageTip.cs +++ b/SunnyUI/Common/UMessageTip.cs @@ -39,7 +39,7 @@ namespace Sunny.UI public static class UIMessageTip { //默认字体。当样式中的Font==null时用该字体替换 - static readonly Font DefaultFont = UIFontColor.Font; + static readonly Font DefaultFont = UIFontColor.Font(); //文本格式。用于测量和绘制 static readonly StringFormat DefStringFormat = StringFormat.GenericTypographic; @@ -213,8 +213,9 @@ namespace Sunny.UI } } }) - { - IsBackground = true, Name = "T_Showing" + { + IsBackground = true, + Name = "T_Showing" }.Start(); } @@ -625,7 +626,7 @@ namespace Sunny.UI Width = 2 }; IconSpacing = 5; - TextFont = UIFontColor.Font; + TextFont = UIFontColor.Font(); var fontName = TextFont.Name; if (fontName == "宋体") { TextOffset = new Point(1, 1); } TextColor = Color.Black; diff --git a/SunnyUI/Controls/DropItem/UIDropControl.cs b/SunnyUI/Controls/DropItem/UIDropControl.cs index 87126863..8a99c485 100644 --- a/SunnyUI/Controls/DropItem/UIDropControl.cs +++ b/SunnyUI/Controls/DropItem/UIDropControl.cs @@ -50,7 +50,7 @@ namespace Sunny.UI SetStyleFlags(); Padding = new Padding(0, 0, 30, 2); - edit.Font = UIFontColor.Font; + edit.Font = UIFontColor.Font(); edit.Left = 3; edit.Top = 3; edit.Text = String.Empty; diff --git a/SunnyUI/Controls/UIButton.cs b/SunnyUI/Controls/UIButton.cs index 4c289c61..160c116f 100644 --- a/SunnyUI/Controls/UIButton.cs +++ b/SunnyUI/Controls/UIButton.cs @@ -135,10 +135,10 @@ namespace Sunny.UI } } - private Font tipsFont = new Font("Microsoft Sans Serif", 9); + private Font tipsFont = UIFontColor.SubFont(); [Description("角标文字字体"), Category("SunnyUI")] - [DefaultValue(typeof(Font), "Microsoft Sans Serif, 9pt")] + [DefaultValue(typeof(Font), "微软雅黑, 9pt")] public Font TipsFont { get { return tipsFont; } diff --git a/SunnyUI/Controls/UIComboboxEx.cs b/SunnyUI/Controls/UIComboboxEx.cs index 436dc75e..c164a0c1 100644 --- a/SunnyUI/Controls/UIComboboxEx.cs +++ b/SunnyUI/Controls/UIComboboxEx.cs @@ -32,7 +32,7 @@ namespace Sunny.UI { Version = UIGlobal.Version; - base.Font = UIFontColor.Font; + base.Font = UIFontColor.Font(); base.ForeColor = UIFontColor.Primary; base.BackColor = Color.White; DrawMode = DrawMode.OwnerDrawFixed; diff --git a/SunnyUI/Controls/UIContextMenuStrip.cs b/SunnyUI/Controls/UIContextMenuStrip.cs index 9e6260cd..e1e79592 100644 --- a/SunnyUI/Controls/UIContextMenuStrip.cs +++ b/SunnyUI/Controls/UIContextMenuStrip.cs @@ -32,7 +32,7 @@ namespace Sunny.UI public UIContextMenuStrip() { - Font = UIFontColor.Font; + Font = UIFontColor.Font(); RenderMode = ToolStripRenderMode.Professional; Renderer = new ToolStripProfessionalRenderer(ColorTable); Version = UIGlobal.Version; diff --git a/SunnyUI/Controls/UIControl.cs b/SunnyUI/Controls/UIControl.cs index 424cb41d..6acd994f 100644 --- a/SunnyUI/Controls/UIControl.cs +++ b/SunnyUI/Controls/UIControl.cs @@ -41,7 +41,7 @@ namespace Sunny.UI public UIControl() { Version = UIGlobal.Version; - base.Font = UIFontColor.Font; + base.Font = UIFontColor.Font(); Size = new Size(100, 35); base.MinimumSize = new Size(1, 1); } diff --git a/SunnyUI/Controls/UIDataGridView.cs b/SunnyUI/Controls/UIDataGridView.cs index 9ff2c81b..15995920 100644 --- a/SunnyUI/Controls/UIDataGridView.cs +++ b/SunnyUI/Controls/UIDataGridView.cs @@ -46,7 +46,7 @@ namespace Sunny.UI { BackgroundColor = UIColor.White; GridColor = UIColor.Blue; - base.Font = UIFontColor.Font; + base.Font = UIFontColor.Font(); base.DoubleBuffered = true; VBar.Parent = this; diff --git a/SunnyUI/Controls/UIDataGridViewFooter.cs b/SunnyUI/Controls/UIDataGridViewFooter.cs index fa5b2a72..2504261f 100644 --- a/SunnyUI/Controls/UIDataGridViewFooter.cs +++ b/SunnyUI/Controls/UIDataGridViewFooter.cs @@ -40,7 +40,7 @@ namespace Sunny.UI RadiusSides = UICornerRadiusSides.None; RectSides = ToolStripStatusLabelBorderSides.None; - Font = UIFontColor.Font; + Font = UIFontColor.Font(); foreColor = UIFontColor.Primary; fillColor = UIColor.LightBlue; } diff --git a/SunnyUI/Controls/UIEdit.cs b/SunnyUI/Controls/UIEdit.cs index bb426599..47e48075 100644 --- a/SunnyUI/Controls/UIEdit.cs +++ b/SunnyUI/Controls/UIEdit.cs @@ -42,7 +42,7 @@ namespace Sunny.UI { //设置为单选边框 BorderStyle = BorderStyle.FixedSingle; - base.Font = UIFontColor.Font; + base.Font = UIFontColor.Font(); base.ForeColor = UIFontColor.Primary; Width = 150; base.MaxLength = 32767; diff --git a/SunnyUI/Controls/UIImageButton.cs b/SunnyUI/Controls/UIImageButton.cs index 98c4adb3..d8ef37cb 100644 --- a/SunnyUI/Controls/UIImageButton.cs +++ b/SunnyUI/Controls/UIImageButton.cs @@ -166,7 +166,7 @@ namespace Sunny.UI Height = 35; Version = UIGlobal.Version; Cursor = Cursors.Hand; - base.Font = UIFontColor.Font; + base.Font = UIFontColor.Font(); } /// diff --git a/SunnyUI/Controls/UILabel.cs b/SunnyUI/Controls/UILabel.cs index 8adcd187..3434c776 100644 --- a/SunnyUI/Controls/UILabel.cs +++ b/SunnyUI/Controls/UILabel.cs @@ -36,7 +36,7 @@ namespace Sunny.UI { public UILabel() { - base.Font = UIFontColor.Font; + base.Font = UIFontColor.Font(); Version = UIGlobal.Version; base.TextAlign = ContentAlignment.MiddleLeft; ForeColorChanged += UILabel_ForeColorChanged; @@ -156,7 +156,7 @@ namespace Sunny.UI { public UILinkLabel() { - Font = UIFontColor.Font; + Font = UIFontColor.Font(); LinkBehavior = LinkBehavior.AlwaysUnderline; Version = UIGlobal.Version; diff --git a/SunnyUI/Controls/UIListBox.cs b/SunnyUI/Controls/UIListBox.cs index a54dfea7..c31ee02a 100644 --- a/SunnyUI/Controls/UIListBox.cs +++ b/SunnyUI/Controls/UIListBox.cs @@ -755,7 +755,7 @@ namespace Sunny.UI // BorderStyle = BorderStyle.FixedSingle; DrawMode = DrawMode.OwnerDrawFixed; - Font = UIFontColor.Font; + Font = UIFontColor.Font(); IntegralHeight = false; ItemHeight = 25; Size = new Size(150, 200); diff --git a/SunnyUI/Controls/UINavBar.cs b/SunnyUI/Controls/UINavBar.cs index c13d5308..6ddaa082 100644 --- a/SunnyUI/Controls/UINavBar.cs +++ b/SunnyUI/Controls/UINavBar.cs @@ -51,7 +51,7 @@ namespace Sunny.UI //SetStyle(ControlStyles.ResizeRedraw, true); DoubleBuffered = true; UpdateStyles(); - Font = UIFontColor.Font; + Font = UIFontColor.Font(); NavBarMenu.VisibleChanged += NavBarMenu_VisibleChanged; Dock = DockStyle.Top; @@ -328,7 +328,7 @@ namespace Sunny.UI set => NavBarMenu.ImageList = value; } - private Font dropMenuFont = UIFontColor.Font; + private Font dropMenuFont = UIFontColor.Font(); /// /// 标题字体 diff --git a/SunnyUI/Controls/UINavMenu.cs b/SunnyUI/Controls/UINavMenu.cs index 988a7339..303661ba 100644 --- a/SunnyUI/Controls/UINavMenu.cs +++ b/SunnyUI/Controls/UINavMenu.cs @@ -61,7 +61,7 @@ namespace Sunny.UI //ShowRootLines = false; DoubleBuffered = true; - Font = UIFontColor.Font; + Font = UIFontColor.Font(); //CheckBoxes = false; ItemHeight = 50; BackColor = Color.FromArgb(56, 56, 56); @@ -260,10 +260,10 @@ namespace Sunny.UI } } - private Font tipsFont = new Font("Microsoft Sans Serif", 9); + private Font tipsFont = UIFontColor.SubFont(); [Description("角标文字字体"), Category("SunnyUI")] - [DefaultValue(typeof(Font), "Microsoft Sans Serif, 9pt")] + [DefaultValue(typeof(Font), "微软雅黑, 9pt")] public Font TipsFont { get => tipsFont; diff --git a/SunnyUI/Controls/UIPanel.cs b/SunnyUI/Controls/UIPanel.cs index 6fee06b6..87b45b77 100644 --- a/SunnyUI/Controls/UIPanel.cs +++ b/SunnyUI/Controls/UIPanel.cs @@ -49,7 +49,7 @@ namespace Sunny.UI InitializeComponent(); Version = UIGlobal.Version; AutoScaleMode = AutoScaleMode.None; - base.Font = UIFontColor.Font; + base.Font = UIFontColor.Font(); base.MinimumSize = new System.Drawing.Size(1, 1); SetStyleFlags(true, false); } diff --git a/SunnyUI/Controls/UITabControl.cs b/SunnyUI/Controls/UITabControl.cs index 8f3fc6c3..f3a90bb1 100644 --- a/SunnyUI/Controls/UITabControl.cs +++ b/SunnyUI/Controls/UITabControl.cs @@ -52,7 +52,7 @@ namespace Sunny.UI ItemSize = new Size(150, 40); DrawMode = TabDrawMode.OwnerDrawFixed; - Font = UIFontColor.Font; + Font = UIFontColor.Font(); AfterSetFillColor(FillColor); Version = UIGlobal.Version; diff --git a/SunnyUI/Controls/UITabControlMenu.cs b/SunnyUI/Controls/UITabControlMenu.cs index d7df302f..b7d5897f 100644 --- a/SunnyUI/Controls/UITabControlMenu.cs +++ b/SunnyUI/Controls/UITabControlMenu.cs @@ -40,7 +40,7 @@ namespace Sunny.UI ItemSize = new Size(40, 200); DrawMode = TabDrawMode.OwnerDrawFixed; - Font = UIFontColor.Font; + Font = UIFontColor.Font(); AfterSetFillColor(FillColor); Size = new Size(450, 270); Version = UIGlobal.Version; diff --git a/SunnyUI/Controls/UITextBox.cs b/SunnyUI/Controls/UITextBox.cs index 5a257664..f0182e7d 100644 --- a/SunnyUI/Controls/UITextBox.cs +++ b/SunnyUI/Controls/UITextBox.cs @@ -55,7 +55,7 @@ namespace Sunny.UI CalcEditHeight(); Height = MinHeight; ShowText = false; - Font = UIFontColor.Font; + Font = UIFontColor.Font(); Padding = new Padding(0); MinimumSize = new Size(1, 16); diff --git a/SunnyUI/Forms/UIEditForm.cs b/SunnyUI/Forms/UIEditForm.cs index 1e0df8b6..2b92c3b1 100644 --- a/SunnyUI/Forms/UIEditForm.cs +++ b/SunnyUI/Forms/UIEditForm.cs @@ -63,7 +63,7 @@ namespace Sunny.UI float size = 0; foreach (var info in Option.Infos) { - SizeF sf = info.Text.MeasureString(UIFontColor.Font); + SizeF sf = info.Text.MeasureString(Font); size = Math.Max(sf.Width, size); } diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index 40075290..0ff08acf 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -432,7 +432,7 @@ namespace Sunny.UI /// /// 标题字体 /// - private Font titleFont = UIFontColor.Font; + private Font titleFont = UIFontColor.Font(); /// /// 标题字体 diff --git a/SunnyUI/Forms/UILoginForm.Designer.cs b/SunnyUI/Forms/UILoginForm.Designer.cs index 90f45bf3..be80ea72 100644 --- a/SunnyUI/Forms/UILoginForm.Designer.cs +++ b/SunnyUI/Forms/UILoginForm.Designer.cs @@ -170,7 +170,7 @@ this.lblSubText.Name = "lblSubText"; this.lblSubText.Size = new System.Drawing.Size(310, 26); this.lblSubText.TabIndex = 7; - this.lblSubText.Text = "SunnyUI V2.2.5"; + this.lblSubText.Text = "SunnyUI"; this.lblSubText.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // uiLabel1 diff --git a/SunnyUI/Frames/UIPage.cs b/SunnyUI/Frames/UIPage.cs index b586144c..1cbd222d 100644 --- a/SunnyUI/Frames/UIPage.cs +++ b/SunnyUI/Frames/UIPage.cs @@ -474,7 +474,7 @@ namespace Sunny.UI /// /// 标题字体 /// - private Font titleFont = UIFontColor.Font; + private Font titleFont = UIFontColor.Font(); /// /// 标题字体 diff --git a/SunnyUI/Style/UIStyle.cs b/SunnyUI/Style/UIStyle.cs index 2c9101af..9f026e1a 100644 --- a/SunnyUI/Style/UIStyle.cs +++ b/SunnyUI/Style/UIStyle.cs @@ -705,23 +705,23 @@ namespace Sunny.UI /// /// 默认字体 /// - public static readonly Font Font = new Font("微软雅黑", 12, FontStyle.Regular, GraphicsUnit.Point, GdiCharSet); - - public static Font CreateFont() + public static Font Font() { - return new Font("微软雅黑", 12, FontStyle.Regular, GraphicsUnit.Point, GdiCharSet); + return new Font("微软雅黑", FontSize, FontStyle.Regular, GraphicsUnit.Point, GdiCharSet); } + public static float FontSize = 12; + /// - /// 默认字体 + /// 默认二级字体 /// - public static readonly Font SubFont = new Font("微软雅黑", 9, FontStyle.Regular, GraphicsUnit.Point, GdiCharSet); - - public static Font CreateSubFont() + public static Font SubFont() { - return new Font("微软雅黑", 9, FontStyle.Regular, GraphicsUnit.Point, GdiCharSet); + return new Font("微软雅黑", SubFontSize, FontStyle.Regular, GraphicsUnit.Point, GdiCharSet); } + public static float SubFontSize = 9; + /// /// 主要颜色 ///