ARCed.Scintilla.IncrementalSearcher.moveFormAwayFromSelection C# (CSharp) Method

moveFormAwayFromSelection() public method

public moveFormAwayFromSelection ( ) : void
return void
        public void moveFormAwayFromSelection()
        {
            if (!Visible || Scintilla == null)
                return;

            int pos = Scintilla.Caret.Position;
            int x = Scintilla.PointXFromPosition(pos);
            int y = Scintilla.PointYFromPosition(pos);

            Point cursorPoint = new Point(x, y);

            Rectangle r = new Rectangle(Location, Size);
            if (r.Contains(cursorPoint))
            {
                Point newLocation;
                if (cursorPoint.Y < (Screen.PrimaryScreen.Bounds.Height / 2))
                {
                    // Top half of the screen
                    newLocation = new Point(Location.X, cursorPoint.Y + Scintilla.Lines.Current.Height * 2);

                }
                else
                {
                    // FixedY half of the screen
                    newLocation = new Point(Location.X, cursorPoint.Y - Height - (Scintilla.Lines.Current.Height * 2));
                }

                Location = newLocation;
            }
        }