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