Ejemplo n.º 1
0
        public bool FindNext(SearchInfo info)
        {
            int rowIndex = CurrentCell != null ? CurrentCell.RowIndex : 0;
            int colIndex = CurrentCell != null ? CurrentCell.ColumnIndex : 0;

            if (_currentCellChanged)
            {
                info.NewSearch      = true;
                _currentCellChanged = false;
            }

            if (info.NewSearch)
            {
                info.Clear();
                info.StartRowIndex    = rowIndex;
                info.StartColumnIndex = colIndex;
            }

            if (info.RestartSearch)
            {
                info.Clear();
                rowIndex = info.StartRowIndex;
                colIndex = info.StartColumnIndex;
            }

            if (info.Finished)
            {
                return(false);
            }

            colIndex++;

            // search from the current cell to the end
            bool result = FindBelow(info, rowIndex, colIndex);

            if (result)
            {
                return(true);
            }

            if (info.Finished)
            {
                return(false);
            }

            return(FindBelow(info, 0, 0));
        }