Example #1
0
        internal void SelectRangeStartByMouse(Point location)
        {
            if (this.viewportController == null || this.viewportController.View == null)
            {
                return;
            }

#if WINFORM || WPF
            if (!Common.Toolkit.IsKeyDown(unvell.Common.Win32Lib.Win32.VKey.VK_SHIFT))
            {
#endif // WINFORM || WPF
            var viewport = this.viewportController.View.GetViewByPoint(location) as IRangeSelectableView;

            if (viewport == null)
            {
                viewport = this.viewportController.FocusView as IRangeSelectableView;
            }

            if (viewport != null)
            {
                Point vp = viewport.PointToView(location);

                var pos = CellsViewport.GetPosByPoint(viewport, vp);
                this.selEnd = this.selStart = pos;
            }
#if WINFORM || WPF
        }
#endif // WINFORM || WPF

            this.SelectRangeEndByMouse(location);
        }
Example #2
0
        internal void SelectRangeEndByMouse(Point location)
        {
            if (this.viewportController == null || this.viewportController.View == null)
            {
                return;
            }

            var viewport = this.viewportController.View.GetViewByPoint(location) as IRangeSelectableView;

            if (viewport == null)
            {
                viewport = this.viewportController.FocusView as IRangeSelectableView;
            }

            if (viewport != null)
            {
                Point vp = viewport.PointToView(location);

                var startpos = this.selStart;
                var endpos   = this.selEnd;

                #region Each Operation Status
                switch (this.operationStatus)
                {
                case OperationStatus.FullColumnSelect:
                {
                    int col = -1;

                    this.FindColumnByPosition(vp.X, out col);

                    if (col > -1)
                    {
                        startpos = new CellPosition(0, startpos.Col);
                        endpos   = new CellPosition(this.rows.Count, col);
                    }
                }
                break;

                case OperationStatus.FullRowSelect:
                {
                    int row = -1;

                    this.FindRowByPosition(vp.Y, out row);

                    if (row > -1)
                    {
                        startpos = new CellPosition(startpos.Row, 0);
                        endpos   = new CellPosition(row, this.cols.Count);
                    }
                }
                break;

                default:
                    endpos = CellsViewport.GetPosByPoint(viewport, vp);
                    break;
                }
                #endregion                 // Each Operation Status

                this.ApplyRangeSelection(startpos, endpos, true);
            }
        }