fix: 修复导航栏收起时展开按钮无法点击的问题

This commit is contained in:
Xu 2025-02-24 20:54:19 +08:00
commit a28c6d06ff

View file

@ -619,14 +619,14 @@ void MainWindow::_ResizeTitleBarWindow() noexcept {
const uint32_t topBorderHeight = _GetTopBorderHeight();
// 将标题栏窗口置于 XAML Islands 窗口上方,覆盖上边框和标题栏控件
RECT clientRect;
GetClientRect(Handle(), &clientRect);
const int titleBarX = (int)std::floorf(rect.X * dpiScale);
const int titleBarWidth = (int)std::ceilf(rect.Width * dpiScale);
SetWindowPos(
_hwndTitleBar.get(),
HWND_TOP,
titleBarX,
0,
0,
clientRect.right,
titleBarWidth,
topBorderHeight + (int)std::floorf(rect.Height * dpiScale + 1), // 不知为何,直接向上取整有时无法遮盖 TitleBarControl
SWP_SHOWWINDOW
);
@ -639,7 +639,7 @@ void MainWindow::_ResizeTitleBarWindow() noexcept {
const int captionButtonHeightInPixels = (int)std::ceilf(captionButtonHeightInDips * dpiScale);
// 确保原生按钮和标题栏按钮高度相同
MoveWindow(_hwndMaximizeButton, 0, topBorderHeight, clientRect.right, captionButtonHeightInPixels, FALSE);
MoveWindow(_hwndMaximizeButton, titleBarX, topBorderHeight, titleBarWidth, captionButtonHeightInPixels, FALSE);
}
// 设置标题栏窗口的最大化样式,这样才能展示正确的文字提示