Пример #1
0
        private void SelectByRectangle(TextRectangle rect)
        {
            if (this.FireUpdateEvent == false)
            {
                throw new InvalidOperationException("");
            }
            if (rect.TopLeft <= rect.BottomRight)
            {
                for (int i = rect.TopLeft.row; i <= rect.BottomLeft.row; i++)
                {
                    int length = this.LayoutLines.GetLengthFromLineNumber(i);
                    int leftCol = rect.TopLeft.col, rightCol = rect.TopRight.col, lastCol = length;
                    if (length > 0 && this.LayoutLines[i][length - 1] == Document.NewLine)
                    {
                        lastCol = length - 1;
                    }
                    if (lastCol < 0)
                    {
                        lastCol = 0;
                    }
                    if (rect.TopLeft.col > lastCol)
                    {
                        leftCol = lastCol;
                    }
                    if (rect.TopRight.col > lastCol)
                    {
                        rightCol = lastCol;
                    }

                    int StartIndex = this.LayoutLines.GetIndexFromTextPoint(new TextPoint(i, leftCol));
                    int EndIndex   = this.LayoutLines.GetIndexFromTextPoint(new TextPoint(i, rightCol));

                    Selection sel;
                    sel = Selection.Create(StartIndex, EndIndex - StartIndex);

                    this.Selections.Add(sel);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 一致するかどうか
        /// </summary>
        /// <param name="o">比較対象</param>
        /// <returns>一致するなら真</returns>
        public override bool Equals(object o)
        {
            TextRectangle b = (TextRectangle)o;

            return(this._TopLeft == b._TopLeft && this._BottomRight == b._BottomRight);
        }