PointXFromPosition() public method

public PointXFromPosition ( int position ) : int
position int
return int
Ejemplo n.º 1
0
        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
                {
                    // Bottom half of the screen
                    newLocation = new Point(Location.X, cursorPoint.Y - Height - (Scintilla.Lines.Current.Height * 2));
                }

                Location = newLocation;
            }
        }
Ejemplo n.º 2
0
        public void SetPosition()
        {
            if (!Visible)
            {
                return;
            }

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

            this.Location = new Point(x, y);
        }