diff --git a/Bin/net40/SunnyUI.Common.dll b/Bin/net40/SunnyUI.Common.dll index 261f9a4a..81645e64 100644 Binary files a/Bin/net40/SunnyUI.Common.dll and b/Bin/net40/SunnyUI.Common.dll differ diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe index 77c18905..05953af2 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 962caa41..39a57036 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Controls/FCombobox.cs b/SunnyUI.Demo/Controls/FCombobox.cs index 398c9f81..9e7ca75d 100644 --- a/SunnyUI.Demo/Controls/FCombobox.cs +++ b/SunnyUI.Demo/Controls/FCombobox.cs @@ -82,17 +82,17 @@ namespace Sunny.UI.Demo private void uiDatePicker1_ValueChanged(object sender, System.DateTime value) { - value.ConsoleWriteLine(); + Console.WriteLine(value); } private void uiTimePicker1_ValueChanged(object sender, System.DateTime value) { - value.ConsoleWriteLine(); + Console.WriteLine(value); } private void uiDatetimePicker1_ValueChanged(object sender, System.DateTime value) { - value.ConsoleWriteLine(); + Console.WriteLine(value); } private void uiColorPicker1_Click(object sender, System.EventArgs e) diff --git a/SunnyUI.Demo/FMain.cs b/SunnyUI.Demo/FMain.cs index 73ff7535..0c7807ee 100644 --- a/SunnyUI.Demo/FMain.cs +++ b/SunnyUI.Demo/FMain.cs @@ -104,7 +104,7 @@ namespace Sunny.UI.Demo private void FMain_Selecting(object sender, TabControlCancelEventArgs e, UIPage page) { - page?.Text.ConsoleWriteLine(); + Console.WriteLine(page?.Text); } private void 关于ToolStripMenuItem1_Click(object sender, EventArgs e) diff --git a/SunnyUI.Demo/Industrial/FMeter.cs b/SunnyUI.Demo/Industrial/FMeter.cs index 051e91b3..526d25e6 100644 --- a/SunnyUI.Demo/Industrial/FMeter.cs +++ b/SunnyUI.Demo/Industrial/FMeter.cs @@ -1,6 +1,4 @@ -using System; - -namespace Sunny.UI.Demo +namespace Sunny.UI.Demo { public partial class FMeter : UIPage { @@ -23,8 +21,6 @@ namespace Sunny.UI.Demo uiRoundMeter1.Angle = value * 10; uiRoundMeter2.Angle = value * 10; uiAnalogMeter1.Value = value; - - Console.WriteLine(DateTime.Now.ToString(DateTimeEx.DateTimeFormatEx)); } } } diff --git a/SunnyUI.Demo/Properties/AssemblyInfo.cs b/SunnyUI.Demo/Properties/AssemblyInfo.cs index 7374d636..96ba8362 100644 --- a/SunnyUI.Demo/Properties/AssemblyInfo.cs +++ b/SunnyUI.Demo/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.6.0")] -[assembly: AssemblyFileVersion("3.0.6.0")] +[assembly: AssemblyVersion("3.0.7.0")] +[assembly: AssemblyFileVersion("3.0.7.0")] diff --git a/SunnyUI.Demo/SunnyUI.Demo.csproj b/SunnyUI.Demo/SunnyUI.Demo.csproj index 2213c1b2..81cf26c1 100644 --- a/SunnyUI.Demo/SunnyUI.Demo.csproj +++ b/SunnyUI.Demo/SunnyUI.Demo.csproj @@ -42,8 +42,8 @@ False ..\Bin\net40\SunnyUI.dll - - ..\packages\SunnyUI.Common.3.0.6\lib\net40\SunnyUI.Common.dll + + ..\packages\SunnyUI.Common.3.0.7\lib\net40\SunnyUI.Common.dll diff --git a/SunnyUI.Demo/packages.config b/SunnyUI.Demo/packages.config index 16032b60..da693c7d 100644 --- a/SunnyUI.Demo/packages.config +++ b/SunnyUI.Demo/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/SunnyUI.Net5.Demo/Controls/FCombobox.cs b/SunnyUI.Net5.Demo/Controls/FCombobox.cs index 8a902fa7..a57eac73 100644 --- a/SunnyUI.Net5.Demo/Controls/FCombobox.cs +++ b/SunnyUI.Net5.Demo/Controls/FCombobox.cs @@ -11,17 +11,17 @@ namespace Sunny.UI.Demo private void uiDatePicker1_ValueChanged(object sender, DateTime value) { - uiDatePicker1.Value.ConsoleWriteLine(); + Console.WriteLine(uiDatePicker1.Value); } private void uiDatetimePicker1_ValueChanged(object sender, DateTime value) { - uiDatetimePicker1.Value.ConsoleWriteLine(); + Console.WriteLine(uiDatetimePicker1.Value); } private void uiTimePicker1_ValueChanged(object sender, DateTime value) { - uiTimePicker1.Value.ConsoleWriteLine(); + Console.WriteLine(uiTimePicker1.Value); } private void uiComboBox1_DropDown(object sender, EventArgs e) diff --git a/SunnyUI.Net5.Demo/FMain.cs b/SunnyUI.Net5.Demo/FMain.cs index 8595bcba..dcc3a7f5 100644 --- a/SunnyUI.Net5.Demo/FMain.cs +++ b/SunnyUI.Net5.Demo/FMain.cs @@ -87,7 +87,7 @@ namespace Sunny.UI.Demo private void FMain_Selecting(object sender, TabControlCancelEventArgs e, UIPage page) { - page?.Text.ConsoleWriteLine(); + Console.WriteLine(page?.Text); } } } \ No newline at end of file diff --git a/SunnyUI.Net5.Demo/SunnyUI.Net5.Demo.csproj b/SunnyUI.Net5.Demo/SunnyUI.Net5.Demo.csproj index f2089a92..2b2e22a3 100644 --- a/SunnyUI.Net5.Demo/SunnyUI.Net5.Demo.csproj +++ b/SunnyUI.Net5.Demo/SunnyUI.Net5.Demo.csproj @@ -6,9 +6,9 @@ true Sunny.UI.Demo SunnyUI.ico - 3.0.6.0 - 3.0.6.0 - 3.0.6 + 3.0.7.0 + 3.0.7.0 + 3.0.7 SunnyUI SunnyUI.Net Copyright ©SunnyUI.Net 2012-2021 @@ -25,7 +25,7 @@ - + diff --git a/SunnyUI/Charts/UIDoughnutChart.cs b/SunnyUI/Charts/UIDoughnutChart.cs index 15c6e070..396101e0 100644 --- a/SunnyUI/Charts/UIDoughnutChart.cs +++ b/SunnyUI/Charts/UIDoughnutChart.cs @@ -20,6 +20,7 @@ * 2021-07-22: V3.0.5 增加更新数据的方法 ******************************************************************************/ +using Sunny.UI.Static; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -207,9 +208,9 @@ namespace Sunny.UI { Angle angle = Angles[pieIndex][azIndex]; PointF pf = angle.Center; - if (MathEx.CalcDistance(e.Location, pf) > angle.Outer) continue; - if (MathEx.CalcDistance(e.Location, pf) < angle.Inner) continue; - double az = MathEx.CalcAngle(e.Location, pf); + if (Drawing.CalcDistance(e.Location, pf) > angle.Outer) continue; + if (Drawing.CalcDistance(e.Location, pf) < angle.Inner) continue; + double az = Drawing.CalcAngle(e.Location, pf); if (az >= angle.Start && az <= angle.Start + angle.Sweep) { SetPieAndAzIndex(pieIndex, azIndex); diff --git a/SunnyUI/Charts/UIPieChart.cs b/SunnyUI/Charts/UIPieChart.cs index 4a3f831c..44df279c 100644 --- a/SunnyUI/Charts/UIPieChart.cs +++ b/SunnyUI/Charts/UIPieChart.cs @@ -20,6 +20,7 @@ * 2021-07-22: V3.0.5 增加更新数据的方法 ******************************************************************************/ +using Sunny.UI.Static; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -232,9 +233,9 @@ namespace Sunny.UI if (!e.Location.InRect(rect)) continue; PointF pf = new PointF(rect.Left + rect.Width / 2.0f, rect.Top + rect.Height / 2.0f); - if (MathEx.CalcDistance(e.Location, pf) * 2 > rect.Width) continue; + if (Drawing.CalcDistance(e.Location, pf) * 2 > rect.Width) continue; - double az = MathEx.CalcAngle(e.Location, pf); + double az = Drawing.CalcAngle(e.Location, pf); for (int azIndex = 0; azIndex < Option.Series[pieIndex].Data.Count; azIndex++) { Angle angle = Angles[pieIndex][azIndex]; diff --git a/SunnyUI/Controls/UIHorScrollBarEx.cs b/SunnyUI/Controls/UIHorScrollBarEx.cs index 581a6ce2..c84bfa5d 100644 --- a/SunnyUI/Controls/UIHorScrollBarEx.cs +++ b/SunnyUI/Controls/UIHorScrollBarEx.cs @@ -131,14 +131,14 @@ namespace Sunny.UI if (inLeftArea) { - int value = (Value - LargeChange).CheckRange(0, Maximum - BoundsWidth); + int value = (Value - LargeChange).CheckInRange(0, Maximum - BoundsWidth); Value = value; ValueChanged?.Invoke(this, null); } if (inRightArea) { - int value = (Value + LargeChange).CheckRange(0, Maximum - BoundsWidth); + int value = (Value + LargeChange).CheckInRange(0, Maximum - BoundsWidth); Value = value; ValueChanged?.Invoke(this, null); } @@ -147,7 +147,7 @@ namespace Sunny.UI { int x = BoundsWidth * (Width - 32) / Maximum; int value = (e.Location.X - x / 2) * maximum / (Width - 32); - value = value.CheckRange(0, Maximum - BoundsWidth); + value = value.CheckInRange(0, Maximum - BoundsWidth); Value = value; ValueChanged?.Invoke(this, null); } @@ -218,7 +218,7 @@ namespace Sunny.UI { int x = BoundsWidth * (Width - 32) / Maximum; int value = (e.Location.X - x / 2) * maximum / (Width - 32); - value = value.CheckRange(0, Maximum - BoundsWidth); + value = value.CheckInRange(0, Maximum - BoundsWidth); Value = value; ValueChanged?.Invoke(this, null); } diff --git a/SunnyUI/Controls/UIRoundProcess.cs b/SunnyUI/Controls/UIRoundProcess.cs index cb81718d..20107be7 100644 --- a/SunnyUI/Controls/UIRoundProcess.cs +++ b/SunnyUI/Controls/UIRoundProcess.cs @@ -19,6 +19,7 @@ * 2021-04-08: V3.0.2 增加文件说明 ******************************************************************************/ +using Sunny.UI.Static; using System; using System.ComponentModel; using System.Drawing; diff --git a/SunnyUI/Controls/UITabControl.cs b/SunnyUI/Controls/UITabControl.cs index 1760123d..49024a03 100644 --- a/SunnyUI/Controls/UITabControl.cs +++ b/SunnyUI/Controls/UITabControl.cs @@ -25,6 +25,7 @@ * 2021-08-14: V3.0.6 增加DisposeTabPageAfterRemove标志,移除TabPage后,是否自动销毁TabPage ******************************************************************************/ +using Sunny.UI.Static; using Sunny.UI.Win32; using System; using System.Collections.Generic; diff --git a/SunnyUI/Controls/UITitlePanel.cs b/SunnyUI/Controls/UITitlePanel.cs index b7685424..ca48b583 100644 --- a/SunnyUI/Controls/UITitlePanel.cs +++ b/SunnyUI/Controls/UITitlePanel.cs @@ -22,6 +22,7 @@ * 2020-09-03: V3.0.6 增加标题文字颜色 ******************************************************************************/ +using Sunny.UI.Static; using System; using System.ComponentModel; using System.Drawing; diff --git a/SunnyUI/Controls/UIVerScrollBarEx.cs b/SunnyUI/Controls/UIVerScrollBarEx.cs index 1311ea20..182d01e3 100644 --- a/SunnyUI/Controls/UIVerScrollBarEx.cs +++ b/SunnyUI/Controls/UIVerScrollBarEx.cs @@ -130,14 +130,14 @@ namespace Sunny.UI if (inLeftArea) { - int value = (Value - LargeChange).CheckRange(0, Maximum - BoundsHeight); + int value = (Value - LargeChange).CheckInRange(0, Maximum - BoundsHeight); Value = value; ValueChanged?.Invoke(this, null); } if (inRightArea) { - int value = (Value + LargeChange).CheckRange(0, Maximum - BoundsHeight); + int value = (Value + LargeChange).CheckInRange(0, Maximum - BoundsHeight); Value = value; ValueChanged?.Invoke(this, null); } @@ -146,7 +146,7 @@ namespace Sunny.UI { int y = BoundsHeight * (Height - 32) / Maximum; int value = (e.Location.Y - y / 2) * maximum / (Height - 32); - value = value.CheckRange(0, Maximum - BoundsHeight); + value = value.CheckInRange(0, Maximum - BoundsHeight); Value = value; ValueChanged?.Invoke(this, null); } @@ -217,7 +217,7 @@ namespace Sunny.UI { int y = BoundsHeight * (Height - 32) / Maximum; int value = (e.Location.Y - y / 2) * maximum / (Height - 32); - value = value.CheckRange(0, Maximum - BoundsHeight); + value = value.CheckInRange(0, Maximum - BoundsHeight); Value = value; ValueChanged?.Invoke(this, null); } diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index aad71f55..1bdf9876 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -28,6 +28,7 @@ * 2021-08-17: V3.0.6 适应主屏幕任务栏在屏幕各个方向均可 ******************************************************************************/ +using Sunny.UI.Static; using System; using System.Collections.Generic; using System.ComponentModel; diff --git a/SunnyUI/Pages/UIPage.cs b/SunnyUI/Pages/UIPage.cs index a21bd039..1e5d652d 100644 --- a/SunnyUI/Pages/UIPage.cs +++ b/SunnyUI/Pages/UIPage.cs @@ -24,6 +24,7 @@ * 2021-08-24: V3.0.6 修复OnLoad在加载时重复加载两次的问题 ******************************************************************************/ +using Sunny.UI.Static; using System; using System.ComponentModel; using System.Diagnostics; diff --git a/SunnyUI/Properties/Resources.Designer.cs b/SunnyUI/Properties/Resources.Designer.cs index 657b25c8..3dbeeb3e 100644 --- a/SunnyUI/Properties/Resources.Designer.cs +++ b/SunnyUI/Properties/Resources.Designer.cs @@ -200,7 +200,7 @@ namespace Sunny.UI.Properties { } /// - /// 查找类似 V3.0.6 的本地化字符串。 + /// 查找类似 V3.0.7 的本地化字符串。 /// internal static string Version { get { diff --git a/SunnyUI/Properties/Resources.resx b/SunnyUI/Properties/Resources.resx index 78b04d7a..d38d7927 100644 --- a/SunnyUI/Properties/Resources.resx +++ b/SunnyUI/Properties/Resources.resx @@ -162,8 +162,8 @@ ..\Resources\notifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - V3.0.6 - 2021-08-12 + V3.0.7 + 2021-09-08 ..\Resources\wind.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/SunnyUI/Static/UGDI.cs b/SunnyUI/Static/UGDI.cs index 7cb4b8bd..f440ee8e 100644 --- a/SunnyUI/Static/UGDI.cs +++ b/SunnyUI/Static/UGDI.cs @@ -113,16 +113,6 @@ namespace Sunny.UI return region; } - public static PointF Center(this Rectangle rect) - { - return new PointF(rect.Left + rect.Width / 2.0f, rect.Top + rect.Height / 2.0f); - } - - public static PointF Center(this RectangleF rect) - { - return new PointF(rect.Left + rect.Width / 2.0f, rect.Top + rect.Height / 2.0f); - } - public static Color Alpha(this Color color, int alpha) { alpha = Math.Max(0, alpha); @@ -189,26 +179,6 @@ namespace Sunny.UI return colors; } - public static bool InRect(this Point point, Rectangle rect) - { - return point.X >= rect.Left && point.X <= rect.Right && point.Y >= rect.Top && point.Y <= rect.Bottom; - } - - public static bool InRect(this Point point, RectangleF rect) - { - return point.X >= rect.Left && point.X <= rect.Right && point.Y >= rect.Top && point.Y <= rect.Bottom; - } - - public static bool InRect(this PointF point, Rectangle rect) - { - return point.X >= rect.Left && point.X <= rect.Right && point.Y >= rect.Top && point.Y <= rect.Bottom; - } - - public static bool InRect(this PointF point, RectangleF rect) - { - return point.X >= rect.Left && point.X <= rect.Right && point.Y >= rect.Top && point.Y <= rect.Bottom; - } - public static void Smooth(this Graphics g, bool smooth = true) { if (smooth) @@ -327,98 +297,6 @@ namespace Sunny.UI return path; } - /// - /// 两个矩阵是否重叠(边沿重叠,也认为是重叠) - /// - /// 第一个矩阵的位置 - /// 第二个矩阵的位置 - /// - public static bool IsOverlap(this Rectangle rc1, Rectangle rc2) - { - return rc1.X + rc1.Width > rc2.X && - rc2.X + rc2.Width > rc1.X && - rc1.Y + rc1.Height > rc2.Y && - rc2.Y + rc2.Height > rc1.Y; - } - - /// - /// 两个矩阵是否重叠(边沿重叠,也认为是重叠) - /// - /// 第一个矩阵的位置 - /// 第二个矩阵的位置 - /// - public static bool IsOverlap(this RectangleF rc1, RectangleF rc2) - { - return rc1.X + rc1.Width > rc2.X && - rc2.X + rc2.Width > rc1.X && - rc1.Y + rc1.Height > rc2.Y && - rc2.Y + rc2.Height > rc1.Y; - } - - /// - /// 两点创建一个矩形 - /// - /// 点1 - /// 点2 - /// 矩形 - public static RectangleF CreateRectangleF(this PointF pf1, PointF pf2) - { - return new RectangleF(Math.Min(pf1.X, pf2.X), Math.Min(pf1.Y, pf2.Y), - Math.Abs(pf1.X - pf2.X), Math.Abs(pf1.Y - pf2.Y)); - } - - /// - /// 两点创建一个矩形 - /// - /// 点1 - /// 点2 - /// 矩形 - public static Rectangle CreateRectangle(this Point pf1, Point pf2) - { - return new Rectangle(Math.Min(pf1.X, pf2.X), Math.Min(pf1.Y, pf2.Y), - Math.Abs(pf1.X - pf2.X), Math.Abs(pf1.Y - pf2.Y)); - } - - public static double CalcY(PointF pf1, PointF pf2, double x) - { - if (pf1.Y.Equals(pf2.Y)) return pf1.Y; - if (pf1.X.Equals(pf2.X)) return float.NaN; - - double a = (pf2.Y - pf1.Y) * 1.0 / (pf2.X - pf1.X); - double b = pf1.Y - a * pf1.X; - return a * x + b; - } - - public static double CalcX(PointF pf1, PointF pf2, double y) - { - if (pf1.X.Equals(pf2.X)) return pf1.X; - if (pf1.Y.Equals(pf2.Y)) return float.NaN; - - double a = (pf2.Y - pf1.Y) * 1.0 / (pf2.X - pf1.X); - double b = pf1.Y - a * pf1.X; - return (y - b) * 1.0 / a; - } - - public static double CalcY(Point pf1, Point pf2, double x) - { - if (pf1.Y == pf2.Y) return pf1.Y; - if (pf1.X == pf2.X) return double.NaN; - - double a = (pf2.Y - pf1.Y) * 1.0 / (pf2.X - pf1.X); - double b = pf1.Y - a * pf1.X; - return a * x + b; - } - - public static double CalcX(Point pf1, Point pf2, double y) - { - if (pf1.Y == pf2.Y) return pf1.X; - if (pf1.X == pf2.X) return double.NaN; - - double a = (pf2.Y - pf1.Y) * 1.0 / (pf2.X - pf1.X); - double b = pf1.Y - a * pf1.X; - return (y - b) * 1.0 / a; - } - /// /// 设置GDI高质量模式抗锯齿 /// diff --git a/SunnyUI/Static/UGraphics.cs b/SunnyUI/Static/UGraphics.cs index e1a5cf5b..d1777d81 100644 --- a/SunnyUI/Static/UGraphics.cs +++ b/SunnyUI/Static/UGraphics.cs @@ -19,6 +19,7 @@ * 2021-08-20: V3.0.6 整理了一些GDI绘图的常用方法扩展 ******************************************************************************/ +using Sunny.UI.Static; using System; using System.Collections.Generic; using System.Drawing; @@ -1012,10 +1013,10 @@ namespace Sunny.UI RectangleF rect1 = pf1.CreateRectangleF(pf2); if (!rect1.IsOverlap(rect)) return; - double x1 = GDI.CalcX(pf1, pf2, rect.Top); - double x2 = GDI.CalcX(pf1, pf2, rect.Bottom); - double y1 = GDI.CalcY(pf1, pf2, rect.Left); - double y2 = GDI.CalcY(pf1, pf2, rect.Right); + double x1 = Drawing.CalcX(pf1, pf2, rect.Top); + double x2 = Drawing.CalcX(pf1, pf2, rect.Bottom); + double y1 = Drawing.CalcY(pf1, pf2, rect.Left); + double y2 = Drawing.CalcY(pf1, pf2, rect.Right); //判断线段是否和区域有交点 bool isExist = x1.InRange(rect.Left, rect.Right) || x2.InRange(rect.Left, rect.Right) || y1.InRange(rect.Top, rect.Bottom) || y2.InRange(rect.Top, rect.Bottom); diff --git a/SunnyUI/Static/USystem.cs b/SunnyUI/Static/USystem.cs index 4fddc536..a8865c10 100644 --- a/SunnyUI/Static/USystem.cs +++ b/SunnyUI/Static/USystem.cs @@ -127,14 +127,6 @@ namespace Sunny.UI return new Point(pos.X, pos.Y); } - public static void ConsoleWriteLine(this object obj, string preText = "") - { - if (preText != "") - Console.WriteLine(preText + ": " + obj); - else - Console.WriteLine(obj.ToString()); - } - /// /// Delays the specified ms. /// diff --git a/SunnyUI/SunnyUI.csproj b/SunnyUI/SunnyUI.csproj index b44df195..44f8354c 100644 --- a/SunnyUI/SunnyUI.csproj +++ b/SunnyUI/SunnyUI.csproj @@ -9,13 +9,13 @@ SunnyUI.Net 是基于.Net Framework 4.0+、.Net Core3.1、.Net 5 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。 CopyRight © SunnyUI.Net 2012-2021 LICENSE - 3.0.6 + 3.0.7 ShenYonghua SunnyUI.Net SunnyUI https://gitee.com/yhuse/SunnyUI https://gitee.com/yhuse/SunnyUI - false + true false SunnyUI.png @@ -56,7 +56,7 @@ - +