From 43beffeadd129e966bcf39f3b83a2cb505292b6d Mon Sep 17 00:00:00 2001 From: CJK_mkp <113243675+CJKmkp@users.noreply.github.com> Date: Tue, 10 Jun 2025 17:50:31 +0800 Subject: [PATCH] try to fix:issue #3 --- .../MainWindow_cs/MW_FloatingBarIcons.cs | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs index 61d5c7e4..83e8c163 100644 --- a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs +++ b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs @@ -1074,15 +1074,16 @@ namespace Ink_Canvas { var windowHandle = new WindowInteropHelper(this).Handle; var screen = System.Windows.Forms.Screen.FromHandle(windowHandle); double screenWidth = screen.Bounds.Width / dpiScaleX, screenHeight = screen.Bounds.Height / dpiScaleY; - var toolbarHeight = SystemParameters.PrimaryScreenHeight - SystemParameters.FullPrimaryScreenHeight - - SystemParameters.WindowCaptionHeight; + + // 修正:直接使用 WorkingArea 计算工作区高度 + double workingAreaHeight = screen.WorkingArea.Height / dpiScaleY; + pos.X = (screenWidth - ViewboxFloatingBar.ActualWidth * ViewboxFloatingBarScaleTransform.ScaleX) / 2; if (PosXCaculatedWithTaskbarHeight == false) - pos.Y = screenHeight - MarginFromEdge * ViewboxFloatingBarScaleTransform.ScaleY; + pos.Y = workingAreaHeight - MarginFromEdge * ViewboxFloatingBarScaleTransform.ScaleY; else if (PosXCaculatedWithTaskbarHeight == true) - pos.Y = screenHeight - ViewboxFloatingBar.ActualHeight * ViewboxFloatingBarScaleTransform.ScaleY - - toolbarHeight - ViewboxFloatingBarScaleTransform.ScaleY * 3; + pos.Y = workingAreaHeight - ViewboxFloatingBar.ActualHeight * ViewboxFloatingBarScaleTransform.ScaleY - ViewboxFloatingBarScaleTransform.ScaleY * 3; if (MarginFromEdge != -60) { if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) { @@ -1137,12 +1138,13 @@ namespace Ink_Canvas { var windowHandle = new WindowInteropHelper(this).Handle; var screen = System.Windows.Forms.Screen.FromHandle(windowHandle); double screenWidth = screen.Bounds.Width / dpiScaleX, screenHeight = screen.Bounds.Height / dpiScaleY; - var toolbarHeight = SystemParameters.PrimaryScreenHeight - SystemParameters.FullPrimaryScreenHeight - - SystemParameters.WindowCaptionHeight; + + // 修正:直接使用 WorkingArea 计算工作区高度 + double workingAreaHeight = screen.WorkingArea.Height / dpiScaleY; + pos.X = (screenWidth - ViewboxFloatingBar.ActualWidth * ViewboxFloatingBarScaleTransform.ScaleX) / 2; - pos.Y = screenHeight - ViewboxFloatingBar.ActualHeight * ViewboxFloatingBarScaleTransform.ScaleY - - toolbarHeight - ViewboxFloatingBarScaleTransform.ScaleY * 3; + pos.Y = workingAreaHeight - ViewboxFloatingBar.ActualHeight * ViewboxFloatingBarScaleTransform.ScaleY - ViewboxFloatingBarScaleTransform.ScaleY * 3; if (pointDesktop.X != -1 || pointDesktop.Y != -1) pointDesktop = pos; @@ -1180,11 +1182,13 @@ namespace Ink_Canvas { var windowHandle = new WindowInteropHelper(this).Handle; var screen = System.Windows.Forms.Screen.FromHandle(windowHandle); double screenWidth = screen.Bounds.Width / dpiScaleX, screenHeight = screen.Bounds.Height / dpiScaleY; - var toolbarHeight = SystemParameters.PrimaryScreenHeight - SystemParameters.FullPrimaryScreenHeight - - SystemParameters.WindowCaptionHeight; + + // 修正:直接使用 WorkingArea 计算工作区高度 + double workingAreaHeight = screen.WorkingArea.Height / dpiScaleY; + pos.X = (screenWidth - ViewboxFloatingBar.ActualWidth * ViewboxFloatingBarScaleTransform.ScaleX) / 2; - pos.Y = screenHeight - 55 * ViewboxFloatingBarScaleTransform.ScaleY; + pos.Y = workingAreaHeight - 55 * ViewboxFloatingBarScaleTransform.ScaleY; if (pointPPT.X != -1 || pointPPT.Y != -1) {