From 303b90a0386c0d742b15b1d2c580e55559bcb28d Mon Sep 17 00:00:00 2001 From: Xu Date: Sun, 29 Dec 2024 12:38:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E6=97=B6=E6=9C=80=E5=A4=A7=E5=8C=96=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E7=9A=84=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Magpie/MainWindow.cpp | 5 ++++- src/Magpie/XamlWindow.h | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Magpie/MainWindow.cpp b/src/Magpie/MainWindow.cpp index ec0c861a..1fa1e7f3 100644 --- a/src/Magpie/MainWindow.cpp +++ b/src/Magpie/MainWindow.cpp @@ -162,7 +162,10 @@ LRESULT MainWindow::_MessageHandler(UINT msg, WPARAM wParam, LPARAM lParam) noex { LRESULT ret = base_type::_MessageHandler(WM_SIZE, wParam, lParam); _ResizeTitleBarWindow(); - Content()->TitleBar().CaptionButtons().IsWindowMaximized(_IsMaximized()); + + // 以最大化显示时实际上是先窗口化显示然后改为最大化,确保最大化按钮状态正确 + Content()->TitleBar().CaptionButtons().IsWindowMaximized( + _IsMaximized() || _IsInitialMaximized()); return ret; } case WM_GETMINMAXINFO: diff --git a/src/Magpie/XamlWindow.h b/src/Magpie/XamlWindow.h index 4594231d..b294d6e6 100644 --- a/src/Magpie/XamlWindow.h +++ b/src/Magpie/XamlWindow.h @@ -423,6 +423,10 @@ class XamlWindowT : public WindowBaseT { _isInitialMaximized = value; } + bool _IsInitialMaximized() const noexcept { + return _isInitialMaximized; + } + private: void _UpdateIslandPosition(int width, int height) const noexcept { // 当窗口以最大化显示时,为了修正动画,实际上是先窗口化显示然后改为最大化。这个过程中此函数