Exemplo n.º 1
0
        protected virtual void OnCellMouseDown(int col, int row, MouseEventArgs mouseEvent)
        {
            try {
                switch (SelectState)
                {
                case GridSelectingState.None:
                case GridSelectingState.Selected:
                    if (CanSelect(col, row))
                    {
                        SelectState    = GridSelectingState.Selecting;
                        SelectionStart = Tuple.Create(col, row);
                        SelectionEnd   = SelectionStart;
                        FireSelectingStarted(col, row);
                        FireSelecting(col, row);
                    }
                    break;

                case GridSelectingState.Selecting:
                default:
                    break;
                }
            } catch (Exception error) {
                SystemLog.Exception(error);
                ExceptionDialog.Show(this, error);
            }
        }
Exemplo n.º 2
0
        protected virtual void OnCellMouseUp(int col, int row, MouseEventArgs mouseEvent)
        {
            try {
                const bool allowMultiColumnSelect = false;
                switch (SelectState)
                {
                case GridSelectingState.Selecting:
                    col = allowMultiColumnSelect ? col : SelectionStart.Item1;
                    if (CanSelect(col, row))
                    {
                        SelectionEnd = Tuple.Create(col, row);
                    }
                    if (AcceptSelection(SelectionStart, SelectionEnd))
                    {
                        SelectState = GridSelectingState.Selected;
                        FireSelectionChanged(col, row);
                        FireSelectionFinished(SelectionStart.Item1, SelectionStart.Item2, col, row);
                    }
                    else
                    {
                        ClearSelection();
                        FireSelectionFinished(SelectionStart.Item1, SelectionStart.Item2, col, row);
                    }
                    break;

                case GridSelectingState.Selected:
                case GridSelectingState.None:
                default:
                    break;
                }
            } catch (Exception error) {
                SystemLog.Exception(error);
                ExceptionDialog.Show(this, error);
            }
        }
Exemplo n.º 3
0
 public virtual void ClearSelection()
 {
     SelectState    = GridSelectingState.None;
     SelectionStart = null;
     SelectionEnd   = null;
     _grid.Selection.ResetSelection(false);
     FireSelectionCleared();
 }
Exemplo n.º 4
0
 public virtual void EndDragging()
 {
     SelectState = GridSelectingState.None;
 }