From 57534ad9c3fb9a032e9cf4df61dcde97757e065b Mon Sep 17 00:00:00 2001 From: Sunny Date: Sun, 21 Jul 2024 20:56:10 +0800 Subject: [PATCH] =?UTF-8?q?*=20UIForm:=20=E4=BF=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=9C=80=E5=A4=A7=E5=8C=96=E5=90=8E?= =?UTF-8?q?=E6=81=A2=E5=A4=8D=E6=97=B6=E7=95=8C=E9=9D=A2=E5=B0=BA=E5=AF=B8?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Forms/UIForm.cs | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index 98e9734c..427b822d 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -58,7 +58,7 @@ * 2024-04-28: V3.6.5 增加WindowStateChanged事件 * 2024-05-16: V3.6.6 Resizable替代ShowDragStretch,显示边框可拖拽调整窗体大小 * 2024-06-08: V3.6.6 防止图标转换错误 - * 2024-07-20: V3.6.8 最大化时,鼠标拖拽标题超过一定范围后再恢复Normal显示 + * 2024-07-20: V3.6.8 修改为初始化最大化后恢复时界面尺寸大小正常 ******************************************************************************/ using System; @@ -255,16 +255,6 @@ namespace Sunny.UI public event EventHandler ExtendBoxClick; - /// - /// 窗体最大化前的大小 - /// - private Size size; - - /// - /// 窗体最大化前所处的位置 - /// - private Point location; - private void ShowMaximize(bool IsOnMoving = false) { Screen screen = Screen.FromPoint(MousePosition); @@ -276,32 +266,12 @@ namespace Sunny.UI if (WindowState == FormWindowState.Normal) { - size = Size; - // 若窗体从正常模式->最大化模式,该操作是由移动窗体至顶部触发的,记录的是移动前的窗体位置 - location = IsOnMoving ? FormLocation : Location; FormEx.SetFormRoundRectRegion(this, 0); DoWindowStateChanged(FormWindowState.Maximized); WindowState = FormWindowState.Maximized; } else if (WindowState == FormWindowState.Maximized) { - if (size.Width == 0 || size.Height == 0) - { - int w = 800; - if (MinimumSize.Width > 0) w = MinimumSize.Width; - int h = 600; - if (MinimumSize.Height > 0) h = MinimumSize.Height; - size = new Size(w, h); - } - - Size = size; - if (location.X == 0 && location.Y == 0) - { - location = new Point(screen.Bounds.Left + screen.Bounds.Width / 2 - size.Width / 2, - screen.Bounds.Top + screen.Bounds.Height / 2 - size.Height / 2); - } - - Location = location; FormEx.SetFormRoundRectRegion(this, ShowRadius ? 5 : 0); DoWindowStateChanged(FormWindowState.Normal); WindowState = FormWindowState.Normal;