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 { // 当窗口以最大化显示时,为了修正动画,实际上是先窗口化显示然后改为最大化。这个过程中此函数