This commit is contained in:
Sunny 2021-09-08 23:21:26 +08:00
parent c78c54b8c7
commit e876004efe
27 changed files with 49 additions and 175 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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)

View File

@ -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)

View File

@ -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));
}
}
}

View File

@ -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")]

View File

@ -42,8 +42,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Bin\net40\SunnyUI.dll</HintPath>
</Reference>
<Reference Include="SunnyUI.Common, Version=3.0.6.0, Culture=neutral, PublicKeyToken=5a271fb7ba597231, processorArchitecture=MSIL">
<HintPath>..\packages\SunnyUI.Common.3.0.6\lib\net40\SunnyUI.Common.dll</HintPath>
<Reference Include="SunnyUI.Common, Version=3.0.7.0, Culture=neutral, PublicKeyToken=5a271fb7ba597231, processorArchitecture=MSIL">
<HintPath>..\packages\SunnyUI.Common.3.0.7\lib\net40\SunnyUI.Common.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SunnyUI.Common" version="3.0.6" targetFramework="net40" />
<package id="SunnyUI.Common" version="3.0.7" targetFramework="net40" />
</packages>

View File

@ -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)

View File

@ -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);
}
}
}

View File

@ -6,9 +6,9 @@
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>Sunny.UI.Demo</RootNamespace>
<ApplicationIcon>SunnyUI.ico</ApplicationIcon>
<AssemblyVersion>3.0.6.0</AssemblyVersion>
<FileVersion>3.0.6.0</FileVersion>
<Version>3.0.6</Version>
<AssemblyVersion>3.0.7.0</AssemblyVersion>
<FileVersion>3.0.7.0</FileVersion>
<Version>3.0.7</Version>
<Authors>SunnyUI</Authors>
<Company>SunnyUI.Net</Company>
<Copyright>Copyright ©SunnyUI.Net 2012-2021</Copyright>
@ -25,7 +25,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SunnyUI" Version="3.0.6" />
<PackageReference Include="SunnyUI" Version="3.0.7" />
</ItemGroup>
<ItemGroup>

View File

@ -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);

View File

@ -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];

View File

@ -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);
}

View File

@ -19,6 +19,7 @@
* 2021-04-08: V3.0.2
******************************************************************************/
using Sunny.UI.Static;
using System;
using System.ComponentModel;
using System.Drawing;

View File

@ -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;

View File

@ -22,6 +22,7 @@
* 2020-09-03: V3.0.6
******************************************************************************/
using Sunny.UI.Static;
using System;
using System.ComponentModel;
using System.Drawing;

View File

@ -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);
}

View File

@ -28,6 +28,7 @@
* 2021-08-17: V3.0.6
******************************************************************************/
using Sunny.UI.Static;
using System;
using System.Collections.Generic;
using System.ComponentModel;

View File

@ -24,6 +24,7 @@
* 2021-08-24: V3.0.6 OnLoad在加载时重复加载两次的问题
******************************************************************************/
using Sunny.UI.Static;
using System;
using System.ComponentModel;
using System.Diagnostics;

View File

@ -200,7 +200,7 @@ namespace Sunny.UI.Properties {
}
/// <summary>
/// 查找类似 V3.0.6 的本地化字符串。
/// 查找类似 V3.0.7 的本地化字符串。
/// </summary>
internal static string Version {
get {

View File

@ -162,8 +162,8 @@
<value>..\Resources\notifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Version" xml:space="preserve">
<value>V3.0.6</value>
<comment>2021-08-12</comment>
<value>V3.0.7</value>
<comment>2021-09-08</comment>
</data>
<data name="wind" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\wind.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>

View File

@ -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;
}
/// <summary>
/// 两个矩阵是否重叠(边沿重叠,也认为是重叠)
/// </summary>
/// <param name="rc1">第一个矩阵的位置</param>
/// <param name="rc2">第二个矩阵的位置</param>
/// <returns></returns>
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;
}
/// <summary>
/// 两个矩阵是否重叠(边沿重叠,也认为是重叠)
/// </summary>
/// <param name="rc1">第一个矩阵的位置</param>
/// <param name="rc2">第二个矩阵的位置</param>
/// <returns></returns>
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;
}
/// <summary>
/// 两点创建一个矩形
/// </summary>
/// <param name="pf1">点1</param>
/// <param name="pf2">点2</param>
/// <returns>矩形</returns>
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));
}
/// <summary>
/// 两点创建一个矩形
/// </summary>
/// <param name="pf1">点1</param>
/// <param name="pf2">点2</param>
/// <returns>矩形</returns>
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;
}
/// <summary>
/// 设置GDI高质量模式抗锯齿
/// </summary>

View File

@ -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);

View File

@ -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());
}
/// <summary>
/// Delays the specified ms.
/// </summary>

View File

@ -9,13 +9,13 @@
<Description>SunnyUI.Net 是基于.Net Framework 4.0+、.Net Core3.1、.Net 5 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。</Description>
<Copyright>CopyRight © SunnyUI.Net 2012-2021</Copyright>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Version>3.0.6</Version>
<Version>3.0.7</Version>
<Authors>ShenYonghua</Authors>
<Company>SunnyUI.Net</Company>
<PackageId>SunnyUI</PackageId>
<PackageProjectUrl>https://gitee.com/yhuse/SunnyUI</PackageProjectUrl>
<RepositoryUrl>https://gitee.com/yhuse/SunnyUI</RepositoryUrl>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageIcon>SunnyUI.png</PackageIcon>
</PropertyGroup>
@ -56,7 +56,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="SunnyUI.Common" Version="3.0.6" />
<PackageReference Include="SunnyUI.Common" Version="3.0.7" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">