This commit is contained in:
Sunny 2024-02-28 20:25:17 +08:00
parent ff40c3b39d
commit 687d698621
2 changed files with 41 additions and 37 deletions

View File

@ -665,32 +665,7 @@ namespace Sunny.UI
if (InMaxBox)
{
InMaxBox = false;
if (!showFullScreen)
{
if (WindowState == FormWindowState.Maximized)
{
WindowState = FormWindowState.Normal;
if (Location.Y < 0) Location = new Point(Location.X, 0);
}
else
{
WindowState = FormWindowState.Maximized;
}
}
else
{
if (WindowState == FormWindowState.Maximized)
{
FormBorderStyle = FormBorderStyle.Sizable;
WindowState = FormWindowState.Normal;
if (Location.Y < 0) Location = new Point(Location.X, 0);
}
else
{
FormBorderStyle = FormBorderStyle.None;
WindowState = FormWindowState.Maximized;
}
}
ShowMaxOrNormal();
}
if (InExtendBox)
@ -708,7 +683,36 @@ namespace Sunny.UI
}
}
private DateTime lastMouseDownTime;
private void ShowMaxOrNormal()
{
if (!showFullScreen)
{
if (WindowState == FormWindowState.Maximized)
{
WindowState = FormWindowState.Normal;
if (Location.Y < 0) Location = new Point(Location.X, 0);
}
else
{
WindowState = FormWindowState.Maximized;
}
}
else
{
if (WindowState == FormWindowState.Maximized)
{
FormBorderStyle = FormBorderStyle.Sizable;
WindowState = FormWindowState.Normal;
if (Location.Y < 0) Location = new Point(Location.X, 0);
}
else
{
FormBorderStyle = FormBorderStyle.None;
WindowState = FormWindowState.Maximized;
}
}
}
/// <summary>
/// 重载鼠标按下事件
/// </summary>
@ -723,15 +727,15 @@ namespace Sunny.UI
if (e.X > ControlBoxLeft) return;
if (!Movable) return;
if (DateTime.Now - lastMouseDownTime <= TimeSpan.FromMilliseconds(500))
if (e.Clicks == 1)
{
lastMouseDownTime = DateTime.Now;
return;
Win32.User.ReleaseCapture();
Win32.User.SendMessage(this.Handle, Win32.User.WM_SYSCOMMAND, Win32.User.SC_MOVE + Win32.User.HTCAPTION, 0);
}
else
{
ShowMaxOrNormal();
}
lastMouseDownTime = DateTime.Now;
Win32.User.ReleaseCapture();
Win32.User.SendMessage(this.Handle, Win32.User.WM_SYSCOMMAND, Win32.User.SC_MOVE + Win32.User.HTCAPTION, 0);
}
/// <summary>

View File

@ -9,7 +9,7 @@
<Description>SunnyUI.Net 是基于.Net Framework 4.0~4.8、.Net6、.Net7 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。</Description>
<Copyright>CopyRight © SunnyUI.Net 2012-2023</Copyright>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
<Version>3.6.3.0</Version>
<Version>3.6.5.0</Version>
<Authors>ShenYonghua</Authors>
<Company>SunnyUI.Net</Company>
<PackageId>SunnyUI</PackageId>
@ -20,7 +20,7 @@
<SignAssembly>False</SignAssembly>
<AssemblyOriginatorKeyFile>D:\MyDocuments\Key\SunnyUI.pfx</AssemblyOriginatorKeyFile>
<DelaySign>False</DelaySign>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
@ -81,7 +81,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="SunnyUI.Common" Version="3.6.3" />
<PackageReference Include="SunnyUI.Common" Version="3.6.5" />
</ItemGroup>
<ItemGroup>