使用Screen.FromPosition方法修复GetMouseInScreen方法的不足

This commit is contained in:
owenc 2020-05-31 00:35:54 +08:00
parent b4aed739ca
commit e9c84298c8

View File

@ -479,8 +479,8 @@ namespace Sunny.UI
private void ShowMaximize(bool IsOnMoving = false)
{
int screenIndex = GetMouseInScreen(MousePosition);
Screen screen = Screen.AllScreens[screenIndex];
//int screenIndex = GetMouseInScreen(MousePosition);
Screen screen = Screen.FromPoint(MousePosition);
if (windowState == FormWindowState.Normal)
{
size = Size;
@ -585,8 +585,8 @@ namespace Sunny.UI
if (!IsDisposed && FormMoveMouseDown)
{
int screenIndex = GetMouseInScreen(PointToScreen(e.Location));
Screen screen = Screen.AllScreens[screenIndex];
//int screenIndex = GetMouseInScreen(PointToScreen(e.Location));
Screen screen = Screen.FromPoint(MousePosition);
if (MousePosition.Y == screen.WorkingArea.Top && MaximizeBox)
{
ShowMaximize(true);