V3.0.7
This commit is contained in:
parent
c78c54b8c7
commit
e876004efe
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -82,17 +82,17 @@ namespace Sunny.UI.Demo
|
|||||||
|
|
||||||
private void uiDatePicker1_ValueChanged(object sender, System.DateTime value)
|
private void uiDatePicker1_ValueChanged(object sender, System.DateTime value)
|
||||||
{
|
{
|
||||||
value.ConsoleWriteLine();
|
Console.WriteLine(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiTimePicker1_ValueChanged(object sender, System.DateTime value)
|
private void uiTimePicker1_ValueChanged(object sender, System.DateTime value)
|
||||||
{
|
{
|
||||||
value.ConsoleWriteLine();
|
Console.WriteLine(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiDatetimePicker1_ValueChanged(object sender, System.DateTime value)
|
private void uiDatetimePicker1_ValueChanged(object sender, System.DateTime value)
|
||||||
{
|
{
|
||||||
value.ConsoleWriteLine();
|
Console.WriteLine(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiColorPicker1_Click(object sender, System.EventArgs e)
|
private void uiColorPicker1_Click(object sender, System.EventArgs e)
|
||||||
|
@ -104,7 +104,7 @@ namespace Sunny.UI.Demo
|
|||||||
|
|
||||||
private void FMain_Selecting(object sender, TabControlCancelEventArgs e, UIPage page)
|
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)
|
private void 关于ToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
using System;
|
namespace Sunny.UI.Demo
|
||||||
|
|
||||||
namespace Sunny.UI.Demo
|
|
||||||
{
|
{
|
||||||
public partial class FMeter : UIPage
|
public partial class FMeter : UIPage
|
||||||
{
|
{
|
||||||
@ -23,8 +21,6 @@ namespace Sunny.UI.Demo
|
|||||||
uiRoundMeter1.Angle = value * 10;
|
uiRoundMeter1.Angle = value * 10;
|
||||||
uiRoundMeter2.Angle = value * 10;
|
uiRoundMeter2.Angle = value * 10;
|
||||||
uiAnalogMeter1.Value = value;
|
uiAnalogMeter1.Value = value;
|
||||||
|
|
||||||
Console.WriteLine(DateTime.Now.ToString(DateTimeEx.DateTimeFormatEx));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||||
//通过使用 "*",如下所示:
|
//通过使用 "*",如下所示:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("3.0.6.0")]
|
[assembly: AssemblyVersion("3.0.7.0")]
|
||||||
[assembly: AssemblyFileVersion("3.0.6.0")]
|
[assembly: AssemblyFileVersion("3.0.7.0")]
|
||||||
|
@ -42,8 +42,8 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\Bin\net40\SunnyUI.dll</HintPath>
|
<HintPath>..\Bin\net40\SunnyUI.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SunnyUI.Common, Version=3.0.6.0, Culture=neutral, PublicKeyToken=5a271fb7ba597231, processorArchitecture=MSIL">
|
<Reference Include="SunnyUI.Common, Version=3.0.7.0, Culture=neutral, PublicKeyToken=5a271fb7ba597231, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\SunnyUI.Common.3.0.6\lib\net40\SunnyUI.Common.dll</HintPath>
|
<HintPath>..\packages\SunnyUI.Common.3.0.7\lib\net40\SunnyUI.Common.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="SunnyUI.Common" version="3.0.6" targetFramework="net40" />
|
<package id="SunnyUI.Common" version="3.0.7" targetFramework="net40" />
|
||||||
</packages>
|
</packages>
|
@ -11,17 +11,17 @@ namespace Sunny.UI.Demo
|
|||||||
|
|
||||||
private void uiDatePicker1_ValueChanged(object sender, DateTime value)
|
private void uiDatePicker1_ValueChanged(object sender, DateTime value)
|
||||||
{
|
{
|
||||||
uiDatePicker1.Value.ConsoleWriteLine();
|
Console.WriteLine(uiDatePicker1.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiDatetimePicker1_ValueChanged(object sender, DateTime value)
|
private void uiDatetimePicker1_ValueChanged(object sender, DateTime value)
|
||||||
{
|
{
|
||||||
uiDatetimePicker1.Value.ConsoleWriteLine();
|
Console.WriteLine(uiDatetimePicker1.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiTimePicker1_ValueChanged(object sender, DateTime value)
|
private void uiTimePicker1_ValueChanged(object sender, DateTime value)
|
||||||
{
|
{
|
||||||
uiTimePicker1.Value.ConsoleWriteLine();
|
Console.WriteLine(uiTimePicker1.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiComboBox1_DropDown(object sender, EventArgs e)
|
private void uiComboBox1_DropDown(object sender, EventArgs e)
|
||||||
|
@ -87,7 +87,7 @@ namespace Sunny.UI.Demo
|
|||||||
|
|
||||||
private void FMain_Selecting(object sender, TabControlCancelEventArgs e, UIPage page)
|
private void FMain_Selecting(object sender, TabControlCancelEventArgs e, UIPage page)
|
||||||
{
|
{
|
||||||
page?.Text.ConsoleWriteLine();
|
Console.WriteLine(page?.Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,9 +6,9 @@
|
|||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<RootNamespace>Sunny.UI.Demo</RootNamespace>
|
<RootNamespace>Sunny.UI.Demo</RootNamespace>
|
||||||
<ApplicationIcon>SunnyUI.ico</ApplicationIcon>
|
<ApplicationIcon>SunnyUI.ico</ApplicationIcon>
|
||||||
<AssemblyVersion>3.0.6.0</AssemblyVersion>
|
<AssemblyVersion>3.0.7.0</AssemblyVersion>
|
||||||
<FileVersion>3.0.6.0</FileVersion>
|
<FileVersion>3.0.7.0</FileVersion>
|
||||||
<Version>3.0.6</Version>
|
<Version>3.0.7</Version>
|
||||||
<Authors>SunnyUI</Authors>
|
<Authors>SunnyUI</Authors>
|
||||||
<Company>SunnyUI.Net</Company>
|
<Company>SunnyUI.Net</Company>
|
||||||
<Copyright>Copyright ©SunnyUI.Net 2012-2021</Copyright>
|
<Copyright>Copyright ©SunnyUI.Net 2012-2021</Copyright>
|
||||||
@ -25,7 +25,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="SunnyUI" Version="3.0.6" />
|
<PackageReference Include="SunnyUI" Version="3.0.7" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
* 2021-07-22: V3.0.5 增加更新数据的方法
|
* 2021-07-22: V3.0.5 增加更新数据的方法
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
using Sunny.UI.Static;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -207,9 +208,9 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
Angle angle = Angles[pieIndex][azIndex];
|
Angle angle = Angles[pieIndex][azIndex];
|
||||||
PointF pf = angle.Center;
|
PointF pf = angle.Center;
|
||||||
if (MathEx.CalcDistance(e.Location, pf) > angle.Outer) continue;
|
if (Drawing.CalcDistance(e.Location, pf) > angle.Outer) continue;
|
||||||
if (MathEx.CalcDistance(e.Location, pf) < angle.Inner) continue;
|
if (Drawing.CalcDistance(e.Location, pf) < angle.Inner) continue;
|
||||||
double az = MathEx.CalcAngle(e.Location, pf);
|
double az = Drawing.CalcAngle(e.Location, pf);
|
||||||
if (az >= angle.Start && az <= angle.Start + angle.Sweep)
|
if (az >= angle.Start && az <= angle.Start + angle.Sweep)
|
||||||
{
|
{
|
||||||
SetPieAndAzIndex(pieIndex, azIndex);
|
SetPieAndAzIndex(pieIndex, azIndex);
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
* 2021-07-22: V3.0.5 增加更新数据的方法
|
* 2021-07-22: V3.0.5 增加更新数据的方法
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
using Sunny.UI.Static;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -232,9 +233,9 @@ namespace Sunny.UI
|
|||||||
if (!e.Location.InRect(rect)) continue;
|
if (!e.Location.InRect(rect)) continue;
|
||||||
|
|
||||||
PointF pf = new PointF(rect.Left + rect.Width / 2.0f, rect.Top + rect.Height / 2.0f);
|
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++)
|
for (int azIndex = 0; azIndex < Option.Series[pieIndex].Data.Count; azIndex++)
|
||||||
{
|
{
|
||||||
Angle angle = Angles[pieIndex][azIndex];
|
Angle angle = Angles[pieIndex][azIndex];
|
||||||
|
@ -131,14 +131,14 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
if (inLeftArea)
|
if (inLeftArea)
|
||||||
{
|
{
|
||||||
int value = (Value - LargeChange).CheckRange(0, Maximum - BoundsWidth);
|
int value = (Value - LargeChange).CheckInRange(0, Maximum - BoundsWidth);
|
||||||
Value = value;
|
Value = value;
|
||||||
ValueChanged?.Invoke(this, null);
|
ValueChanged?.Invoke(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inRightArea)
|
if (inRightArea)
|
||||||
{
|
{
|
||||||
int value = (Value + LargeChange).CheckRange(0, Maximum - BoundsWidth);
|
int value = (Value + LargeChange).CheckInRange(0, Maximum - BoundsWidth);
|
||||||
Value = value;
|
Value = value;
|
||||||
ValueChanged?.Invoke(this, null);
|
ValueChanged?.Invoke(this, null);
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
int x = BoundsWidth * (Width - 32) / Maximum;
|
int x = BoundsWidth * (Width - 32) / Maximum;
|
||||||
int value = (e.Location.X - x / 2) * maximum / (Width - 32);
|
int value = (e.Location.X - x / 2) * maximum / (Width - 32);
|
||||||
value = value.CheckRange(0, Maximum - BoundsWidth);
|
value = value.CheckInRange(0, Maximum - BoundsWidth);
|
||||||
Value = value;
|
Value = value;
|
||||||
ValueChanged?.Invoke(this, null);
|
ValueChanged?.Invoke(this, null);
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
int x = BoundsWidth * (Width - 32) / Maximum;
|
int x = BoundsWidth * (Width - 32) / Maximum;
|
||||||
int value = (e.Location.X - x / 2) * maximum / (Width - 32);
|
int value = (e.Location.X - x / 2) * maximum / (Width - 32);
|
||||||
value = value.CheckRange(0, Maximum - BoundsWidth);
|
value = value.CheckInRange(0, Maximum - BoundsWidth);
|
||||||
Value = value;
|
Value = value;
|
||||||
ValueChanged?.Invoke(this, null);
|
ValueChanged?.Invoke(this, null);
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
* 2021-04-08: V3.0.2 增加文件说明
|
* 2021-04-08: V3.0.2 增加文件说明
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
using Sunny.UI.Static;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
* 2021-08-14: V3.0.6 增加DisposeTabPageAfterRemove标志,移除TabPage后,是否自动销毁TabPage
|
* 2021-08-14: V3.0.6 增加DisposeTabPageAfterRemove标志,移除TabPage后,是否自动销毁TabPage
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
using Sunny.UI.Static;
|
||||||
using Sunny.UI.Win32;
|
using Sunny.UI.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
* 2020-09-03: V3.0.6 增加标题文字颜色
|
* 2020-09-03: V3.0.6 增加标题文字颜色
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
using Sunny.UI.Static;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
@ -130,14 +130,14 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
if (inLeftArea)
|
if (inLeftArea)
|
||||||
{
|
{
|
||||||
int value = (Value - LargeChange).CheckRange(0, Maximum - BoundsHeight);
|
int value = (Value - LargeChange).CheckInRange(0, Maximum - BoundsHeight);
|
||||||
Value = value;
|
Value = value;
|
||||||
ValueChanged?.Invoke(this, null);
|
ValueChanged?.Invoke(this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inRightArea)
|
if (inRightArea)
|
||||||
{
|
{
|
||||||
int value = (Value + LargeChange).CheckRange(0, Maximum - BoundsHeight);
|
int value = (Value + LargeChange).CheckInRange(0, Maximum - BoundsHeight);
|
||||||
Value = value;
|
Value = value;
|
||||||
ValueChanged?.Invoke(this, null);
|
ValueChanged?.Invoke(this, null);
|
||||||
}
|
}
|
||||||
@ -146,7 +146,7 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
int y = BoundsHeight * (Height - 32) / Maximum;
|
int y = BoundsHeight * (Height - 32) / Maximum;
|
||||||
int value = (e.Location.Y - y / 2) * maximum / (Height - 32);
|
int value = (e.Location.Y - y / 2) * maximum / (Height - 32);
|
||||||
value = value.CheckRange(0, Maximum - BoundsHeight);
|
value = value.CheckInRange(0, Maximum - BoundsHeight);
|
||||||
Value = value;
|
Value = value;
|
||||||
ValueChanged?.Invoke(this, null);
|
ValueChanged?.Invoke(this, null);
|
||||||
}
|
}
|
||||||
@ -217,7 +217,7 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
int y = BoundsHeight * (Height - 32) / Maximum;
|
int y = BoundsHeight * (Height - 32) / Maximum;
|
||||||
int value = (e.Location.Y - y / 2) * maximum / (Height - 32);
|
int value = (e.Location.Y - y / 2) * maximum / (Height - 32);
|
||||||
value = value.CheckRange(0, Maximum - BoundsHeight);
|
value = value.CheckInRange(0, Maximum - BoundsHeight);
|
||||||
Value = value;
|
Value = value;
|
||||||
ValueChanged?.Invoke(this, null);
|
ValueChanged?.Invoke(this, null);
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
* 2021-08-17: V3.0.6 适应主屏幕任务栏在屏幕各个方向均可
|
* 2021-08-17: V3.0.6 适应主屏幕任务栏在屏幕各个方向均可
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
using Sunny.UI.Static;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
* 2021-08-24: V3.0.6 修复OnLoad在加载时重复加载两次的问题
|
* 2021-08-24: V3.0.6 修复OnLoad在加载时重复加载两次的问题
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
using Sunny.UI.Static;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
2
SunnyUI/Properties/Resources.Designer.cs
generated
2
SunnyUI/Properties/Resources.Designer.cs
generated
@ -200,7 +200,7 @@ namespace Sunny.UI.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 V3.0.6 的本地化字符串。
|
/// 查找类似 V3.0.7 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string Version {
|
internal static string Version {
|
||||||
get {
|
get {
|
||||||
|
@ -162,8 +162,8 @@
|
|||||||
<value>..\Resources\notifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\notifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Version" xml:space="preserve">
|
<data name="Version" xml:space="preserve">
|
||||||
<value>V3.0.6</value>
|
<value>V3.0.7</value>
|
||||||
<comment>2021-08-12</comment>
|
<comment>2021-09-08</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="wind" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<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>
|
<value>..\Resources\wind.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
@ -113,16 +113,6 @@ namespace Sunny.UI
|
|||||||
return region;
|
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)
|
public static Color Alpha(this Color color, int alpha)
|
||||||
{
|
{
|
||||||
alpha = Math.Max(0, alpha);
|
alpha = Math.Max(0, alpha);
|
||||||
@ -189,26 +179,6 @@ namespace Sunny.UI
|
|||||||
return colors;
|
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)
|
public static void Smooth(this Graphics g, bool smooth = true)
|
||||||
{
|
{
|
||||||
if (smooth)
|
if (smooth)
|
||||||
@ -327,98 +297,6 @@ namespace Sunny.UI
|
|||||||
return path;
|
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>
|
/// <summary>
|
||||||
/// 设置GDI高质量模式抗锯齿
|
/// 设置GDI高质量模式抗锯齿
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
* 2021-08-20: V3.0.6 整理了一些GDI绘图的常用方法扩展
|
* 2021-08-20: V3.0.6 整理了一些GDI绘图的常用方法扩展
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
using Sunny.UI.Static;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
@ -1012,10 +1013,10 @@ namespace Sunny.UI
|
|||||||
RectangleF rect1 = pf1.CreateRectangleF(pf2);
|
RectangleF rect1 = pf1.CreateRectangleF(pf2);
|
||||||
if (!rect1.IsOverlap(rect)) return;
|
if (!rect1.IsOverlap(rect)) return;
|
||||||
|
|
||||||
double x1 = GDI.CalcX(pf1, pf2, rect.Top);
|
double x1 = Drawing.CalcX(pf1, pf2, rect.Top);
|
||||||
double x2 = GDI.CalcX(pf1, pf2, rect.Bottom);
|
double x2 = Drawing.CalcX(pf1, pf2, rect.Bottom);
|
||||||
double y1 = GDI.CalcY(pf1, pf2, rect.Left);
|
double y1 = Drawing.CalcY(pf1, pf2, rect.Left);
|
||||||
double y2 = GDI.CalcY(pf1, pf2, rect.Right);
|
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);
|
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);
|
||||||
|
@ -127,14 +127,6 @@ namespace Sunny.UI
|
|||||||
return new Point(pos.X, pos.Y);
|
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>
|
/// <summary>
|
||||||
/// Delays the specified ms.
|
/// Delays the specified ms.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -9,13 +9,13 @@
|
|||||||
<Description>SunnyUI.Net 是基于.Net Framework 4.0+、.Net Core3.1、.Net 5 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。</Description>
|
<Description>SunnyUI.Net 是基于.Net Framework 4.0+、.Net Core3.1、.Net 5 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。</Description>
|
||||||
<Copyright>CopyRight © SunnyUI.Net 2012-2021</Copyright>
|
<Copyright>CopyRight © SunnyUI.Net 2012-2021</Copyright>
|
||||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
<Version>3.0.6</Version>
|
<Version>3.0.7</Version>
|
||||||
<Authors>ShenYonghua</Authors>
|
<Authors>ShenYonghua</Authors>
|
||||||
<Company>SunnyUI.Net</Company>
|
<Company>SunnyUI.Net</Company>
|
||||||
<PackageId>SunnyUI</PackageId>
|
<PackageId>SunnyUI</PackageId>
|
||||||
<PackageProjectUrl>https://gitee.com/yhuse/SunnyUI</PackageProjectUrl>
|
<PackageProjectUrl>https://gitee.com/yhuse/SunnyUI</PackageProjectUrl>
|
||||||
<RepositoryUrl>https://gitee.com/yhuse/SunnyUI</RepositoryUrl>
|
<RepositoryUrl>https://gitee.com/yhuse/SunnyUI</RepositoryUrl>
|
||||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||||
<PackageIcon>SunnyUI.png</PackageIcon>
|
<PackageIcon>SunnyUI.png</PackageIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -56,7 +56,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="SunnyUI.Common" Version="3.0.6" />
|
<PackageReference Include="SunnyUI.Common" Version="3.0.7" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
|
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user