improve:任务栏高度计算

This commit is contained in:
2025-07-25 17:57:04 +08:00
parent 8c657a4ccf
commit 4efd6abb56
@@ -2,8 +2,6 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace Ink_Canvas.Helpers
{
@@ -95,23 +93,5 @@ namespace Ink_Canvas.Helpers
return "Unknown";
}
}
public static int GetTaskbarHeight(Screen screen, double dpiScaleY)
{
// 优先用工作区和屏幕区的差值法,兼容多屏
int height = 0;
if (screen.Bounds.Height > screen.WorkingArea.Height)
{
// 任务栏在上下
height = screen.Bounds.Height - screen.WorkingArea.Height;
}
else if (screen.Bounds.Width > screen.WorkingArea.Width)
{
// 任务栏在左右
height = screen.Bounds.Width - screen.WorkingArea.Width;
}
// 考虑DPI缩放
return (int)(height / dpiScaleY);
}
}
}