예제 #1
0
        void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
        {
            if (e.Cell.RowIndex > 0 && e.Cell.ColumnIndex > 0)
            {
                int j = GetColorID(GridRangeInfo.Cell(e.Cell.RowIndex, e.Cell.ColumnIndex));
                e.Style.Background = (j == -1) ? e.Style.Background = new SolidColorBrush(Color.FromArgb(255, 00, 59, 81)) : colorCollection[j];
            }
            for (int i = 1; i < 8; i++)
            {
                if (e.Style.RowIndex == 0 && e.Style.ColumnIndex == i)
                {
                    int    n = 64;
                    String s = ((char)((int)n + i)).ToString();
                    e.Style.CellValue = s;
                }
            }

            for (int i = 1; i < 11; i++)
            {
                if (e.Style.RowIndex == i && e.Style.ColumnIndex == 0)
                {
                    e.Style.CellValue = i;
                }
            }

            if (e.Style.RowIndex > 0 && e.Style.ColumnIndex > 0)
            {
                e.Style.CellValue = (isDataBaseRelated) ? dbDT.Rows[e.Cell.RowIndex - 1][e.Cell.ColumnIndex - 1] : dt.Rows[e.Cell.RowIndex - 1][e.Cell.ColumnIndex - 1];
            }
        }
예제 #2
0
            protected override void OnClick(int rowIndex, int colIndex, MouseEventArgs e)
            {
                Rectangle rect = this.Grid.RangeInfoToRectangle(GridRangeInfo.Cell(rowIndex, colIndex));

                rect.Width = 50;
                if (unreadMessage != null)
                {
                    if (unreadMessage.Contains(rowIndex))
                    {
                        unreadMessage.Remove(rowIndex);
                    }
                }
                if (rect.Contains(e.Location))
                {
                    if (unreadMessage.Contains(rowIndex))
                    {
                        unreadMessage.Remove(rowIndex);
                    }
                    else
                    {
                        unreadMessage.Add(rowIndex);
                    }
                }
                clickedRow = rowIndex;
                clickedCol = colIndex;
                base.OnClick(rowIndex, colIndex, e);
                this.Grid.RefreshRange(GridRangeInfo.Cells(rowIndex, colIndex, rowIndex, colIndex));
            }
예제 #3
0
 void CalcGrid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
 {
     if (e.ColIndex > 0)
     {
         int j = GetColorID(GridRangeInfo.Cell(e.RowIndex, e.ColIndex));
         e.Style.BackColor = (j == -1) ? ColorTranslator.FromHtml("#003B51") : colorCollection[j];
     }
 }
예제 #4
0
 void CalcGrid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
 {
     if (e.Cell.RowIndex > 0 && e.Cell.ColumnIndex > 0)
     {
         int j = GetColorID(GridRangeInfo.Cell(e.Cell.RowIndex, e.Cell.ColumnIndex));
         e.Style.Background = (j == -1) ? e.Style.Background = new SolidColorBrush(Color.FromArgb(255, 00, 59, 81)) : colorCollection[j];
     }
 }
예제 #5
0
        void cellgrid_SelectionChanging(object sender, SelectionChangingEventArgs args)
        {
            if (disableCell && args.ActiveRange.Contains(GridRangeInfo.Cell(3, 3)))
            {
                args.Cancel = true;
            }

            eventsTxtBox.Text += "\nSelection changing";
        }
 void Model_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
 {
     if ((bool)checkBox1.IsChecked &&
         e.Range != GridRangeInfo.Empty &&
         e.Range.Contains(GridRangeInfo.Cell(3, 3)))
     {
         e.Cancel = true;
     }
 }
        private void grid_CurrentCellMoved(object sender, GridCurrentCellMovedEventArgs e)
        {
            GridCurrentCell cc = this.grid.CurrentCell;

            this.grid.RefreshRange(GridRangeInfo.Cell(0, cc.MoveFromColIndex));
            this.grid.RefreshRange(GridRangeInfo.Cell(0, cc.MoveToColIndex));
            this.grid.RefreshRange(GridRangeInfo.Row(cc.MoveToRowIndex));
            this.grid.RefreshRange(GridRangeInfo.Row(cc.MoveFromRowIndex));
        }
 /// <internalonly/>
 public Point GetRedArrowIndicatorLocation(int rowIndex)
 {
     if (rowIndex > 0)
     {
         Rectangle r  = grid.RangeInfoToRectangle(GridRangeInfo.Cell(rowIndex, 0));
         Point     pt = grid.IsRightToLeft() ? new Point(r.Right, r.Top) : r.Location;
         return(grid.GridPointToScreen(pt));
     }
     return(Point.Empty);
 }
예제 #9
0
 private void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
 {
     if (e.Cell.RowIndex > 0 && e.Cell.ColumnIndex > 0)
     {
         if (grid.Model.SelectedRanges.AnyRangeContains(GridRangeInfo.Cell(e.Cell.RowIndex, e.Cell.ColumnIndex)))
         {
             e.Style.Borders.All = new Pen(Brushes.DarkGreen, 2);
         }
     }
 }
예제 #10
0
        private void DrawLink(bool useHotColor, int rowIndex, int colIndex)
        {
            if (useHotColor)
            {
                _drawHotLink = true;
            }

            this.Grid.RefreshRange(GridRangeInfo.Cell(rowIndex, colIndex), GridRangeOptions.None);

            _drawHotLink = false;
        }
        private void SizeColumnZero()
        {
            int count    = grid.ScrollRows.GetVisibleLines().Count;
            int rowIndex = grid.ScrollRows.GetVisibleLines()[count - 1].LineIndex;

            if (rowIndex.ToString().Length != charCount)
            {
                grid.Model.ResizeColumnsToFit(GridRangeInfo.Cell(rowIndex, 0), GridResizeToFitOptions.IncludeHeaders);
                charCount = rowIndex.ToString().Length;
            }
        }
예제 #12
0
            protected override void OnMouseMove(int rowIndex, int colIndex, MouseEventArgs e)
            {
                Rectangle range = this.Grid.RangeInfoToRectangle(GridRangeInfo.Cell(rowIndex, colIndex));

                range.Width = 50;

                if (range.Contains(e.Location))
                {
                }
                moveRowIndex = rowIndex;
                moveColIndex = colIndex;
                base.OnMouseMove(rowIndex, colIndex, e);
            }
        bool IsOverCheckBox(int r, int c, MouseEventArgs e)
        {
            GridStyleInfo        style    = grid.Model[r, c];
            GridCellRendererBase renderer = grid.CellRenderers[style.CellType];

            renderer.PerformLayout(r, c, style, grid.RangeInfoToRectangle(GridRangeInfo.Cell(r, c)));
            if (renderer.RaiseHitTest(r, c, e, null) == GridHitTestContext.CheckBoxChecker)
            {
                return(true);
            }

            return(false);
        }
예제 #14
0
        private void CultureInfoSelected(Object sender, RoutedEventArgs e)
        {
            ComboBoxItem item = sender as ComboBoxItem;
            Thread       t    = Thread.CurrentThread;

            t.CurrentCulture = new CultureInfo(item.Content.ToString());

            g.CultureInfo = t.CurrentCulture;
            grid.CurrentCell.EndEdit();
            grid.CurrentCell.BeginEdit();
            this.grid.Model.InvalidateCell(GridRangeInfo.Cell(g.RowIndex, g.ColumnIndex));
            this.grid.Model.InvalidateVisual(true);
        }
예제 #15
0
        void Model_SelectionChanged(object sender, GridSelectionChangedEventArgs e)
        {
            //invalidate last range to remove old borders
            if (oldRange != null)
            {
                for (int row = oldRange.Top; row <= oldRange.Bottom; row++)
                {
                    for (int col = oldRange.Left; col <= oldRange.Right; col++)
                    {
                        if (!this.Model.SelectedRanges.Contains(GridRangeInfo.Cell(row, col)))
                        {
                            if (col + 1 != this.Model.ColumnCount)
                            {
                                this.Model[row, col + 1].Borders.Left = null;
                            }
                            else
                            {
                                this.Model[row, col - 1].Borders.Right = null;
                            }
                        }
                    }
                }
                InvalidateCell(oldRange);
            }

            foreach (GridRangeInfo range in this.Model.SelectedRanges)
            {
                for (int row = range.Top; row <= range.Bottom; row++)
                {
                    for (int col = range.Left; col <= range.Right; col++)
                    {
                        int    rh;
                        double width = this.Model.ColumnWidths[col];

                        if (width == 0)
                        {
                            if (col + 1 != this.Model.ColumnCount)
                            {
                                this.Model[row, col + 1].Borders.Left = new Pen(Brushes.Black, 2);
                            }
                            else
                            {
                                this.Model[row, col - 1].Borders.Right = new Pen(Brushes.Black, 2);
                            }
                        }
                    }
                }
            }
            oldRange = e.Range;
            this.Model.InvalidateVisual(true);
        }
예제 #16
0
        //used to change teh ControlValue if dropdown was closed with Done.
        public override void DropDownContainerCloseDropDown(object sender, PopupClosedEventArgs e)
        {
            if (e.PopupCloseType == PopupCloseType.Done)
            {
                if (this.NotifyCurrentCellChanging())
                {
                    ControlValue = this.ddUser.GetValuesToString();
                    this.NotifyCurrentCellChanged();
                }
            }
            Grid.InvalidateRange(GridRangeInfo.Cell(RowIndex, ColIndex), GridRangeOptions.MergeCoveredCells);             // Merge all cells

            base.DropDownContainerCloseDropDown(sender, e);
        }
예제 #17
0
        private void GridControl_MouseMove(object sender, MouseEventArgs e)
        {
            var            _grid     = sender as GridControl;
            RowColumnIndex rowColumn = _grid.PointToCellRowColumnIndex(e);

            if (_grid.Model.SelectedRanges.AnyRangeContains(GridRangeInfo.Cell(rowColumn.RowIndex, rowColumn.ColumnIndex)))
            {
                Mouse.SetCursor(Cursors.Hand);
            }
            else
            {
                Mouse.SetCursor(Cursors.Arrow);
            }
        }
 void grid_PrepareRenderCell(object sender, GridPrepareRenderCellEventArgs e)
 {
     if (e.Cell.RowIndex == 0 && grid.Model.SelectedRanges.AnyRangeIntersects(GridRangeInfo.Col(e.Cell.ColumnIndex)))
     {
         e.Style.Background = this.excelOrangeColHeader;
     }
     else if (e.Cell.ColumnIndex == 0 && grid.Model.SelectedRanges.AnyRangeIntersects(GridRangeInfo.Row(e.Cell.RowIndex)))
     {
         e.Style.Background = this.excelOrangeRowHeader;
     }
     else if (inRangeSelection && selectedRange.Contains(GridRangeInfo.Cell(e.Cell.RowIndex, e.Cell.ColumnIndex)))
     {
         e.Style.Background = formulaRangeSelectionBrush;
     }
 }
예제 #19
0
        protected override void OnButtonClicked(int rowIndex, int colIndex, int button)
        {
            this.Grid.CurrentCell.MoveTo(rowIndex, colIndex);
            //Console.WriteLine("clicked ({0},{1})", rowIndex, colIndex);

            this.ddForm.SetValuesFromString(this.Grid.Model[rowIndex, colIndex].Text);
            Rectangle rect = this.Grid.RangeInfoToRectangle(GridRangeInfo.Cell(rowIndex, colIndex));

            this.ddForm.Location = this.Grid.PointToScreen(new Point(rect.Left, rect.Bottom));

            if (this.ddForm.ShowDialog() == DialogResult.OK)
            {
                this.Grid.Model[rowIndex, colIndex].Text = this.ddForm.GetValuesToString();
            }
            //base.OnButtonClicked (rowIndex, colIndex, button);
        }
예제 #20
0
        void HScrollBar_ValueChanged(object sender, EventArgs e)
        {
            int row, col;

            Grid.PointToRowCol(dateTimePicker.Location, out row, out col);
            if (!Grid.ViewLayout.VisibleCellsRange.IntersectsWith(GridRangeInfo.Cell(row, col)) || (row <= this.Grid.Model.Rows.HeaderCount) || !(row.Equals(RowIndex) && col.Equals(ColIndex)))
            {
                this.dateTimePicker.Hide();
                this.dateTimePicker.ShowDropButton = false;
            }
            else
            {
                this.dateTimePicker.Show();
                this.dateTimePicker.ShowDropButton = true;
            }
        }
예제 #21
0
        public override void ChildClosing(IPopupChild childUi, PopupCloseType popupCloseType)
        {
            if (popupCloseType == PopupCloseType.Done && !IsReadOnly())
            {
                if (!NotifyCurrentCellChanging())
                {
                    return;
                }

                SetValue(RowIndex, ColIndex, _colorPicker.SelectedColor);

                Grid.InvalidateRange(GridRangeInfo.Cell(RowIndex, ColIndex));
                NotifyCurrentCellChanged();
            }
            DropDownContainerCloseDropDown(childUi, new PopupClosedEventArgs(popupCloseType));
        }
예제 #22
0
        private void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
        {
            //show border for current cell while selecting the set of cells
            if (grid.Model.SelectedRanges.ActiveRange.Contains(GridRangeInfo.Cell(e.Cell.RowIndex, e.Cell.ColumnIndex)))
            {
                if (e.Cell.RowIndex == grid.CurrentCell.RowIndex && e.Cell.ColumnIndex == grid.CurrentCell.ColumnIndex)
                {
                    e.Style.Borders.All = new Pen(Brushes.Black, 2);
                }
            }

            //show border for select the single cell or current cell
            if (e.Cell.RowIndex == grid.CurrentCell.RowIndex && e.Cell.ColumnIndex == grid.CurrentCell.ColumnIndex)
            {
                e.Style.Borders.All = new Pen(Brushes.Black, 2);
            }
        }
예제 #23
0
        /// <summary>
        /// Load the form for Setting the Grid
        /// </summary>
        void Form1_Load(object sender, EventArgs e)
        {
            grdDropDown.BeginUpdate();
            grdDropDown.DataSource              = CreateTable();
            grdDropDown.DisplayMember           = "Name";
            grdDropDown.ValueMember             = "Id";
            grdDropDown.SelectionMode           = SelectionMode.One;
            grdDropDown.ShowColumnHeader        = false;
            grdDropDown.FillLastColumn          = true;
            grdDropDown.BorderStyle             = BorderStyle.FixedSingle;
            grdDropDown.ThemesEnabled           = false;
            grdDropDown.Grid.VerticalThumbTrack = true;

            grdDropDown.Grid.DrawCellDisplayText += Grid_DrawCellDisplayText;
            grdDropDown.EndUpdate();
            grdDropDown.Grid.QueryCellInfo += Grid_QueryCellInfo;

            DataTable dtRuleType = new DataTable();

            dtRuleType.Columns.Add("RuleType");
            dtRuleType.Rows.Add("Format all value cells based on their value range");
            dtRuleType.Rows.Add("Format all value cells based on certain criteria");
            dtRuleType.Rows.Add("Format top or bottom ranked value cells");
            dtRuleType.Rows.Add("Format only value cells containing above or below average");
            dtRuleType.Rows.Add("Format only unique or duplicate value cells");

            grdRuleType.DataSource              = dtRuleType;
            grdRuleType.DisplayMember           = "RuleType";
            grdRuleType.SelectionMode           = SelectionMode.One;
            grdRuleType.ShowColumnHeader        = false;
            grdRuleType.FillLastColumn          = true;
            grdRuleType.BorderStyle             = BorderStyle.FixedSingle;
            grdRuleType.ThemesEnabled           = false;
            grdRuleType.Grid.VerticalThumbTrack = true;

            // default selection
            grdRuleType.Grid.Model.Selections.Add(GridRangeInfo.Cell(1, 1));
            loadRule1Combobox();
            imageSelection(5);

            cboRule2SummaryElement.SelectedIndex = 0;
            cboRule1ImageName.TextBox.Text       = "3-Triangle";

            ApplyConditionalFormat();
        }
예제 #24
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var currentSelectedRanges = grid.Model.SelectedRanges.Clone();

            grid.Model.Selections.Clear(false);
            for (int i = 1; i <= grid.Model.RowCount; i++)
            {
                for (int j = 1; j <= grid.Model.ColumnCount; j++)
                {
                    var cellRange = GridRangeInfo.Cell(i, j);
                    if (!currentSelectedRanges.AnyRangeContains(cellRange))
                    {
                        grid.Model.SelectedRanges.Add(cellRange);
                    }
                }
            }
            grid.Model.InvalidateVisual();
        }
예제 #25
0
            protected override void OnMouseHoverLeave(int rowIndex, int colIndex, EventArgs e)
            {
                Rectangle clRect     = this.Grid.RangeInfoToRectangle(GridRangeInfo.Cell(rowIndex, colIndex));
                Rectangle closeImage = new Rectangle(clRect.X + clRect.Width - 25, clRect.Y + 22, 21, 21);
                Rectangle flagImage  = new Rectangle(clRect.X + clRect.Width - 50, clRect.Y + 2, 21, 21);

                using (Graphics g = this.Grid.CreateGridGraphics())
                {
                    if (moveRowIndex == rowIndex && moveColIndex == colIndex)
                    {
                        g.FillRectangle(Brushes.White, closeImage);
                        g.FillRectangle(Brushes.White, flagImage);
                    }
                    g.Dispose();
                }
                this.Grid.RefreshRange(GridRangeInfo.Cells(rowIndex, colIndex, rowIndex, colIndex));
                base.OnMouseHoverLeave(rowIndex, colIndex, e);
            }
예제 #26
0
        /// <summary>
        /// Display the folder browser dialog.
        /// </summary>
        private void gridControl1_CellButtonClicked(object sender, GridCellButtonClickedEventArgs e)
        {
            GridRangeInfo rg = GridRangeInfo.Cell(e.RowIndex, e.ColIndex);

            if (e.ColIndex == 7)
            {
                MessageBox.Show("Clicked button at " + rg.ToString());
            }
            if (e.ColIndex == 8)
            {
                DialogResult result = openFileDialog1.ShowDialog();
                if (result == DialogResult.OK)
                {
                    string file = openFileDialog1.FileName;
                    try
                    {
                        setFile(file);
                    }
                    catch (IOException)
                    {
                    }
                }
            }
            if (e.ColIndex == 6)
            {
                DialogResult result = openFileDialog1.ShowDialog();
                if (result == DialogResult.OK)
                {
                    string file = openFileDialog1.FileName;
                    try
                    {
                        MessageBox.Show("File is selected");
                    }
                    catch (IOException)
                    {
                    }
                }
            }
            if (e.ColIndex == 4 && e.RowIndex == 6)
            {
                MessageBox.Show("Clicked Button: " + e.Button.Text + "\nRow Index: " + e.RowIndex + "\nColumn Index: " + e.ColIndex, "Click Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #27
0
        public override void CreateRendererElement(UserControl1 uiElement, GridRenderStyleInfo style)
        {
            var range = this.GridControl.Model.SelectedRanges;
            var grid  = uiElement.child;

            if (range != null && range.AnyRangeContains(GridRangeInfo.Cell(style.CellIdentity.RowIndex, style.CellIdentity.ColumnIndex)))
            {
                if (grid.Model.SelectedRanges.Count == 0)
                {
                    grid.Model.SelectedRanges.Add(GridRangeInfo.Table());
                    grid.InvalidateCell(GridRangeInfo.Cell(0, 0));
                }
            }
            else
            {
                grid.Model.SelectedRanges.Clear();
                grid.InvalidateCells();
            }
            base.CreateRendererElement(uiElement, style);
        }
예제 #28
0
            /// <summary>
            /// overriden to invalidate the mousedown cellrange
            /// </summary>
            /// <param name="rowIndex">rowIndex of this cell in grid</param>
            /// <param name="colIndex">colIndex of this cell in grid</param>
            /// <param name="e">mouse event data</param>
            protected override void OnMouseDown(int rowIndex, int colIndex, MouseEventArgs e)
            {
                GridRangeInfo range = GridRangeInfo.Cell(rowIndex, colIndex);

                if (!range.IsEmpty)
                {
                    Grid.Model.GetSpannedRangeInfo(range.Top, range.Left, out this.mouseDownRange);
                    GridStyleInfo style = this.Grid.Model[range.Top, range.Left];
                    if (!style.Clickable || this.Grid.CellRenderers[style.CellType] != this)
                    {
                        this.mouseDownRange = GridRangeInfo.Empty;
                    }
                }

                this.mouseDown  = !mouseDownRange.IsEmpty;
                this.hoverRange = GridRangeInfo.Empty;
                if (this.mouseDown)
                {
                    this.inMouseDownRange = true;
                    this.Grid.InvalidateRange(this.mouseDownRange);
                }
                base.OnMouseDown(rowIndex, colIndex, e);
            }
 void FormulaSupportWithRangeSelectionsHelper_PreviewMouseMove(object sender, MouseEventArgs e)
 {
     if (inRangeSelection && usingMouse)
     {
         currentCell = grid.PointToCellRowColumnIndex(e);
         int top = 0, bottom = 0, left = 0, right = 0;
         grid.ScrollRows.GetVisibleSection(ScrollAxisRegion.Body, out top, out bottom);
         grid.ScrollColumns.GetVisibleSection(ScrollAxisRegion.Body, out left, out right);
         if (currentCell.RowIndex >= grid.ScrollRows.LastBodyVisibleLineIndex)
         {
             grid.ScrollRows.ScrollToNextLine();
         }
         else if (currentCell.RowIndex <= top)
         {
             grid.ScrollRows.ScrollToPreviousLine();
         }
         if (currentCell.ColumnIndex >= grid.ScrollColumns.LastBodyVisibleLineIndex)
         {
             grid.ScrollColumns.ScrollToNextLine();
         }
         else if (currentCell.ColumnIndex <= left)
         {
             grid.ScrollColumns.ScrollToPreviousLine();
         }
         if (currentCell.RowIndex > 0 && currentCell.ColumnIndex > 0 &&
             (currentCell.ColumnIndex != lastCol || currentCell.RowIndex != lastRow))
         {
             lastCol = currentCell.ColumnIndex;
             lastRow = currentCell.RowIndex;
             GridRangeInfo range = selectedRange;
             selectedRange = GridRangeInfo.Cell(startRow, startCol).UnionRange(GridRangeInfo.Cell(lastRow, lastCol));
             PlaceTextInCell(false, selectedRange);
             grid.InvalidateCell(range.UnionRange(selectedRange));
             e.Handled = true;
         }
     }
 }
        public virtual void MouseMove(MouseControllerEventArgs e)
        {
            RowColumnIndex Currentcell = grid.PointToCellRowColumnIndex(e.Location);

            if (IsMouseDown && Currentcell != null)
            {
                if ((MoveDir == MovingDirection.None || MoveDir == MovingDirection.Down) && Currentcell.RowIndex > MouseDownRange.Bottom)
                {
                    this.AddSelectedRanges(GridRangeInfo.Cell(Currentcell.RowIndex, MouseDownRange.Right), Currentcell, MovingDirection.Down);
                    grid.ScrollInView(new RowColumnIndex(Math.Min(grid.Model.RowCount, Currentcell.RowIndex), Currentcell.ColumnIndex));
                }
                else if ((MoveDir == MovingDirection.None || MoveDir == MovingDirection.Up) && Currentcell.RowIndex < MouseDownRange.Top)
                {
                    this.AddSelectedRanges(GridRangeInfo.Cell(Currentcell.RowIndex, MouseDownRange.Right), Currentcell, MovingDirection.Up);
                    grid.ScrollInView(new RowColumnIndex(Math.Max(grid.Model.FrozenRows + 1, Currentcell.RowIndex - 1), Currentcell.ColumnIndex));
                }
                else if ((MoveDir == MovingDirection.None || MoveDir == MovingDirection.Right) && Currentcell.ColumnIndex > MouseDownRange.Right)
                {
                    this.AddSelectedRanges(GridRangeInfo.Cell(MouseDownRange.Top, Currentcell.ColumnIndex), Currentcell, MovingDirection.Right);
                    grid.ScrollInView(new RowColumnIndex(Currentcell.RowIndex, Math.Min(grid.Model.ColumnCount, Currentcell.ColumnIndex + 1)));
                }
                else if ((MoveDir == MovingDirection.None || MoveDir == MovingDirection.Left) && Currentcell.ColumnIndex < MouseDownRange.Left)
                {
                    this.AddSelectedRanges(GridRangeInfo.Cell(MouseDownRange.Top, Currentcell.ColumnIndex), Currentcell, MovingDirection.Left);
                    grid.ScrollInView(new RowColumnIndex(Currentcell.RowIndex, Math.Max(grid.Model.FrozenColumns + 1, Currentcell.ColumnIndex - 1)));
                }
                else
                {
                    if (MouseDownRange.Contains(GridRangeInfo.Cell(Currentcell.RowIndex, Currentcell.ColumnIndex)))
                    {
                        MoveDir = MovingDirection.None;
                        Gridmodel.Selections.Clear();
                        Gridmodel.Selections.Add(MouseDownRange);
                    }
                }
            }
        }