Ejemplo n.º 1
0
 private CellRange GetReferenceCell(SelMove rowMove, SelMove colMove, bool extend)
 {
     CellRange selection = _grid.Selection;
     CellRange cellRange = new CellRange(selection.Row, selection.Column);
     cellRange = _grid.GetMergedRange(_grid.Cells, cellRange);
     SelMove selMove = rowMove;
     switch (selMove)
     {
         case SelMove.None:
         {
             cellRange.Row = selection.Row;
             break;
         }
         case SelMove.Next:
         {
             cellRange.Row = cellRange.BottomRow;
             break;
         }
         default:
         {
             if (selMove != SelMove.NextCell)
             {
                 break;
             }
             goto case SelMove.Next;
         }
     }
     SelMove selMove1 = colMove;
     switch (selMove1)
     {
         case SelMove.None:
         {
             cellRange.Column = selection.Column;
             break;
         }
         case SelMove.Next:
         {
             cellRange.Column = cellRange.RightColumn;
             break;
         }
         default:
         {
             if (selMove1 != SelMove.NextCell)
             {
                 break;
             }
             goto case SelMove.Next;
         }
     }
     return cellRange;
 }
Ejemplo n.º 2
0
 public void MoveSelection(SelMove rowMove, SelMove colMove, bool extend, double pageSize)
 {
     RowCollection rows = _grid.Rows;
     ColumnCollection columns = _grid.Columns;
     CellRange referenceCell = GetReferenceCell(rowMove, colMove, extend);
     if (colMove == SelMove.NextCell)
     {
         int num = columns.FindVisibleCell(referenceCell.Column, SelMove.Next, pageSize);
         int row = referenceCell.Row;
         if (num == referenceCell.Column)
         {
             row = rows.FindVisibleCell(row, SelMove.Next, pageSize);
             if (row > referenceCell.Row)
             {
                 num = columns.FindVisibleCell(0, SelMove.Next, pageSize);
                 num = columns.FindVisibleCell(num, SelMove.Previous, pageSize);
             }
         }
         _grid.Select(row, num, true);
     }
     else if (colMove != SelMove.PreviousCell)
     {
         int num1 = rows.FindVisibleCell(referenceCell.Row, rowMove, pageSize);
         int num2 = columns.FindVisibleCell(referenceCell.Column, colMove, pageSize);
         if (!extend)
         {
             _grid.Select(num1, num2, true);
         }
         else
         {
             CellRange selection = _grid.Selection;
             _grid.Select(num1, num2, selection.Row2, selection.Column2, true);
         }
         Point scrollPosition = _grid.ScrollPosition;
         if (referenceCell.Row >= _grid.Rows.Frozen && num1 < _grid.Rows.Frozen)
         {
             scrollPosition.Y = 0;
         }
         if (referenceCell.Column >= _grid.Columns.Frozen && num2 < _grid.Columns.Frozen)
         {
             scrollPosition.X = 0;
         }
         _grid.ScrollPosition = scrollPosition;
     }
     else
     {
         int num3 = columns.FindVisibleCell(referenceCell.Column, SelMove.Previous, pageSize);
         int row1 = referenceCell.Row;
         if (num3 == referenceCell.Column)
         {
             row1 = rows.FindVisibleCell(row1, SelMove.Previous, pageSize);
             if (row1 < referenceCell.Row)
             {
                 num3 = columns.FindVisibleCell(columns.Count - 1, SelMove.Previous, pageSize);
                 num3 = columns.FindVisibleCell(num3, SelMove.Next, pageSize);
             }
         }
         _grid.Select(row1, num3, true);
     }
     if (_grid.ActiveEditor == null)
     {
         Util.Util.SetFocus(_grid);
     }
 }
Ejemplo n.º 3
0
 private void MoveSelection(SelMove rowMove, SelMove colMove, bool extend, double pageSize)
 {
     _grid.SelectionHandler.MoveSelection(rowMove, colMove, extend, pageSize);
 }