ScreenSaver.ScreenSaverForm.ScreenSaverForm_MouseMove C# (CSharp) Method

ScreenSaverForm_MouseMove() private method

private ScreenSaverForm_MouseMove ( object sender, MouseEventArgs e ) : void
sender object
e MouseEventArgs
return void
        private void ScreenSaverForm_MouseMove(object sender, MouseEventArgs e)
        {
            Point m = PointToClient(Cursor.Position);
            bool? toTop = m.Y < 10 ? true : (m.Y > (Size.Height - 10) ? false : (bool?)null);
            bool? toLeft = m.X < 10 ? true : (m.X > (Size.Width - 10) ? false : (bool?)null);

            if (toTop == true && toLeft == true) Cursor = Cursors.SizeNWSE;
            if (toTop == true && toLeft == null) Cursor = Cursors.SizeNS;
            if (toTop == true && toLeft == false) Cursor = Cursors.SizeNESW;

            if (toTop == false && toLeft == true) Cursor = Cursors.SizeNESW;
            if (toTop == false && toLeft == null) Cursor = Cursors.SizeNS;
            if (toTop == false && toLeft == false) Cursor = Cursors.SizeNWSE;

            if (toTop == null && toLeft == true) Cursor = Cursors.SizeWE;
            if (toTop == null && toLeft == null) Cursor = Cursors.Default;
            if (toTop == null && toLeft == false) Cursor = Cursors.SizeWE;

            if (!mouseLocation.IsEmpty)
            {
                // Terminate if mouse is moved a significant distance
                if (Math.Abs(mouseLocation.X - e.X) > 5 ||
                    Math.Abs(mouseLocation.Y - e.Y) > 5)
                    ShouldExit();
            }

            // Update current mouse location
            mouseLocation = e.Location;
            if (windowMode) this.btnClose.Visible = true;
        }