Revert "将GetMouseInScreen方法替换为Screen.FromControl,原因是在自动最大化过程中,由于窗体是向上停靠的,窗体的大部分区域都在要放大的屏幕上。若使用鼠标位置判断窗体所处屏幕,双屏且副显示器在下时,在副显示器中向顶部停靠,由于AllScreens的第一个是主屏幕,得到的需放大屏幕是错误的。"

This reverts commit 706573fcda16e6af9079853559ec24fb403f19e3.
This commit is contained in:
owenc 2020-05-31 00:30:34 +08:00
parent 706573fcda
commit b4aed739ca

View File

@ -479,8 +479,8 @@ namespace Sunny.UI
private void ShowMaximize(bool IsOnMoving = false)
{
//int screenIndex = GetMouseInScreen(MousePosition);
Screen screen = Screen.FromControl(this);
int screenIndex = GetMouseInScreen(MousePosition);
Screen screen = Screen.AllScreens[screenIndex];
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.FromControl(this);
int screenIndex = GetMouseInScreen(PointToScreen(e.Location));
Screen screen = Screen.AllScreens[screenIndex];
if (MousePosition.Y == screen.WorkingArea.Top && MaximizeBox)
{
ShowMaximize(true);