示例#1
0
        public static IRowCol Advance(this IRowCol RowCol, int Length)
        {
            int col = RowCol.ColNum + Length;
            int row = RowCol.RowNum;

            // negative advance and column off the charts to the left.
            while (col < RowCol.HorzBounds.a)
            {
                col += RowCol.Width();
                row -= 1;
                if (row < RowCol.VertBounds.a)
                {
                    row = RowCol.VertBounds.b;
                }
            }

            // positive advance and column out of bounds to the right.
            while (col > RowCol.HorzBounds.b)
            {
                col -= RowCol.Width();
                row += 1;
                if (row > RowCol.VertBounds.b)
                {
                    row = RowCol.VertBounds.a;
                }
            }

            return(new ZeroRowCol(row, col));
        }