Blue.Windows.StickyWindow.Move C# (CSharp) Метод

Move() приватный Метод

private Move ( Point p ) : void
p Point
Результат void
        private void Move( Point p )
        {
            p = originalForm.PointToScreen ( p );
            Screen activeScr = Screen.FromPoint ( p );	// get the screen from the point !!

            if ( !activeScr.WorkingArea.Contains ( p ) )
            {
                p.X = NormalizeInside ( p.X, activeScr.WorkingArea.Left, activeScr.WorkingArea.Right );
                p.Y = NormalizeInside ( p.Y, activeScr.WorkingArea.Top, activeScr.WorkingArea.Bottom );
            }

            p.Offset ( -offsetPoint.X, -offsetPoint.Y );

            // p is the exact location of the frame - so we can play with it
            // to detect the new position acording to different bounds
            formRect.Location = p;	// this is the new positon of the form

            formOffsetPoint.X	= stickGap + 1;	// (more than) maximum gaps
            formOffsetPoint.Y	= stickGap + 1;

            if ( stickToScreen )
                Move_Stick ( activeScr.WorkingArea, false );

            // Now try to snap to other windows
            if ( stickToOther )
            {
                foreach ( Form sw in GlobalStickyWindows )
                {
                    if ( sw != this.originalForm )
                        Move_Stick( sw.Bounds, true );
                }
            }

            if ( formOffsetPoint.X == stickGap+1 )
                formOffsetPoint.X = 0;
            if ( formOffsetPoint.Y == stickGap+1 )
                formOffsetPoint.Y = 0;

            formRect.Offset ( formOffsetPoint );

            originalForm.Bounds = formRect;
        }