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

This commit is contained in:
owenc 2020-05-31 00:23:01 +08:00
parent 1de5bf46a5
commit 706573fcda

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.FromControl(this);
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.FromControl(this);
if (MousePosition.Y == screen.WorkingArea.Top && MaximizeBox)
{
ShowMaximize(true);