public virtual int HitTest(MouseControllerEventArgs mouseEventArgs, IMouseController controller)
        {
            Point point = mouseEventArgs.Location;

            GridRangeInfo range = grid.Model.SelectedCells;

            if (range == null || range.IsEmpty)
            {
                return(0);
            }

            RowColumnIndex pos = grid.PointToCellRowColumnIndex(point, true);

            if (pos != RowColumnIndex.Empty && MoveDir != MovingDirection.None)
            {
                return(1);
            }

            VisibleLineInfo hitRow = HitRowTest(point);

            if (hitRow != null && !this.IsNotNested(hitRow) && range.Bottom == hitRow.LineIndex)
            {
                VisibleLineInfo column = HitColTest(point);
                if (column != null && range.Right == column.LineIndex)
                {
                    return(1);
                }
            }

            return(0);
        }
        public int HitTest(MouseControllerEventArgs mouseEventArgs, IMouseController controller)
        {
            Point point = mouseEventArgs.Location;

            GridRangeInfo range = Grid.Model.SelectedCells;

            if (range == null || range.IsEmpty)
            {
                return(0);
            }

            RowColumnIndex  pos    = Grid.PointToCellRowColumnIndex(point, true);
            VisibleLineInfo hitRow = HitRowTest(point);

            if (hitRow != null && !this.IsNotNested(hitRow) && range.Bottom == hitRow.LineIndex)
            {
                VisibleLineInfo column = HitColTest(point);//Grid.ScrollColumns.GetVisibleLineAtPoint(point.X);

                if (column != null && range.Right == column.LineIndex)
                {
                    //  Grid.InvalidateCells();
                    return(1);
                }
            }
            return(0);
        }
        public virtual void MouseUp(MouseControllerEventArgs e)
        {
            Internalmovdir = MoveDir;
            BackUpCellValues.Clear();
            CellData = new GridCellData();

            for (int Row = Gridmodel.SelectedCells.Top; Row <= Gridmodel.SelectedCells.Bottom; Row++)
            {
                for (int Column = this.SelectedRange.Left; Column <= this.SelectedRange.Right; Column++)
                {
                    var CellRowColumnIndex            = new RowColumnIndex(Row, Column);
                    GridStyleInfoStore styleinfostore = (GridStyleInfoStore)this.grid.Model[Row, Column].Store.Clone();
                    //this.CellData[this.grid.Model[Row, Column].CellRowColumnIndex] = styleinfostore;
                    BackUpCellValues.Add(CellRowColumnIndex, styleinfostore);//this.CellData[this.grid.Model[Row, Column].CellRowColumnIndex]);
                }
            }
            this.InnerFillType = SeriesType.FillSeries;
            this.FillData();

            MoveDir     = MovingDirection.None;
            IsMouseDown = false;

#if !SILVERLIGHT
            if (Buttonside == MouseButton.Left)
#else
            if (Buttonside == MouseButtons.Left)
#endif
            {
                OpenFilterDropDown();
            }
        }
 public void MouseDown(MouseControllerEventArgs e)
 {
     isMouseDown    = true;
     mouseDownRange = Grid.Model.SelectedCells;
     mouseDownPoint = e.Location;
     moveDir        = MovingDirection.None;
     flag           = 0;
 }
 public virtual void MouseDown(MouseControllerEventArgs e)
 {
     //flag = 0;
     Buttonside       = e.Button;
     this.IsMouseDown = true;
     MoveDir          = MovingDirection.None;
     this.grid.CurrentCell.Deactivate();
     this.CurrentBaseRange = this.MouseDownRange = this.Gridmodel.SelectedCells;
 }
 public void MouseUp(MouseControllerEventArgs e)
 {
     //throw new NotImplementedException();
     if (mouseDownRange != Grid.Model.SelectedCells && ExcelRangeExtended != null)
     {
         ExcelRangeExtendedEventArgs1 arg = new ExcelRangeExtendedEventArgs1(mouseDownRange, Grid.Model.SelectedCells);
         ExcelRangeExtended(Grid, arg);
     }
 }
 public void MouseDown(MouseControllerEventArgs e)
 {
     isMouseDown    = true;
     mouseDownRange = Grid.Model.SelectedCells;
     mouseDownPoint = e.Location;
     moveDir        = MovingDirection.None;
     flag           = 0;
     if (e.Button == MouseButton.Left)
     {
         this.currentValue = this.Grid.CurrentCell.Renderer.ControlValue;
     }
 }
        public void MouseUp(MouseControllerEventArgs e)
        {
            //throw new NotImplementedException();
            if (mouseDownRange != Grid.Model.SelectedCells && ExcelRangeExtended != null)
            {
                this.FillDraggedRanges();
                ExcelRangeExtendedEventArgs arg = new ExcelRangeExtendedEventArgs(mouseDownRange, Grid.Model.SelectedCells);
                ExcelRangeExtended(Grid, arg);
            }

            moveDir = MovingDirection.None;
            Grid.InvalidateCells();
        }
        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);
                    }
                }
            }
        }
 public virtual void MouseHover(MouseControllerEventArgs e)
 {
     //throw new NotImplementedException();
 }
        public void MouseMove(MouseControllerEventArgs e)
        {
            RowColumnIndex cell = Grid.PointToCellRowColumnIndex(e.Location);

            if (isMouseDown && cell.RowIndex != 0 && cell.ColumnIndex != 0)
            {
                if (cell.RowIndex < Grid.TopRowIndex && Grid.TopRowIndex > Grid.Model.FrozenRows)
                {
                    Grid.TopRowIndex = Grid.TopRowIndex - 1;
                }
                else if (cell.ColumnIndex < Grid.LeftColumnIndex && Grid.LeftColumnIndex > Grid.Model.FrozenColumns)
                {
                    Grid.LeftColumnIndex = Grid.LeftColumnIndex - 1;
                }

                Rect r = Grid.CellSpanToRect(ScrollAxisRegion.Body, ScrollAxisRegion.Body, new CellSpanInfo(cell.RowIndex, cell.ColumnIndex, cell.RowIndex, cell.ColumnIndex));


                if (flag == 0)
                {
                    top    = mouseDownRange.Top;
                    bottom = mouseDownRange.Bottom;
                    left   = mouseDownRange.Left;
                    right  = mouseDownRange.Right;
                    // MessageBox.Show(mouseDownRange.Left.ToString());
                    flag = 1;
                }


                if (mouseDownRange.Top == top && mouseDownRange.Bottom == bottom && mouseDownRange.Right == right && mouseDownRange.Left == left && flag == 1)
                {
                    moveDir = MovingDirection.None;
                    //flag = 0;
                }

                if ((moveDir == MovingDirection.None || moveDir == MovingDirection.Down) &&
                    (cell.RowIndex > mouseDownRange.Bottom || flag == 1) && cell.RowIndex > mouseDownRange.Bottom && e.Location.Y > r.Top + r.Height / 2)
                {
                    moveDir = MovingDirection.Down;
                    Grid.Model.Selections.Clear();
                    Grid.Model.Selections.Add(mouseDownRange.UnionRange(GridRangeInfo.Cell(cell.RowIndex, mouseDownRange.Right)));
                    Grid.ScrollInView(new RowColumnIndex(Math.Min(Grid.Model.RowCount, cell.RowIndex), cell.ColumnIndex));
                }
                else if ((moveDir == MovingDirection.None || moveDir == MovingDirection.Up) &&
                         cell.RowIndex < mouseDownRange.Top && e.Location.Y < r.Top - r.Height / 2)
                {
                    moveDir = MovingDirection.Up;
                    Grid.Model.Selections.Clear();
                    Grid.Model.Selections.Add(mouseDownRange.UnionRange(GridRangeInfo.Cell(cell.RowIndex, mouseDownRange.Right)));
                    Grid.ScrollInView(new RowColumnIndex(Math.Max(Grid.Model.FrozenRows + 1, cell.RowIndex - 1), cell.ColumnIndex));
                }
                else if ((moveDir == MovingDirection.None || moveDir == MovingDirection.Right) &&
                         cell.ColumnIndex > mouseDownRange.Right && e.Location.X > r.Left + r.Width / 2)
                {
                    if (cell.RowIndex >= mouseDownRange.Top && cell.RowIndex <= mouseDownRange.Bottom)
                    {
                        moveDir = MovingDirection.Right;
                        Grid.Model.Selections.Clear();
                        Grid.Model.Selections.Add(mouseDownRange.UnionRange(GridRangeInfo.Cell(cell.RowIndex, cell.ColumnIndex)));
                        Grid.ScrollInView(new RowColumnIndex(cell.RowIndex, Math.Min(Grid.Model.ColumnCount, cell.ColumnIndex + 1)));
                    }
                }
                else if ((moveDir == MovingDirection.None || moveDir == MovingDirection.Left) &&
                         cell.ColumnIndex < mouseDownRange.Left && e.Location.X < r.Left - r.Width / 2)
                {
                    moveDir = MovingDirection.Left;
                    Grid.Model.Selections.Clear();
                    Grid.Model.Selections.Add(mouseDownRange.UnionRange(GridRangeInfo.Cell(mouseDownRange.Top, cell.ColumnIndex)));
                    Grid.ScrollInView(new RowColumnIndex(cell.RowIndex, Math.Max(Grid.Model.FrozenColumns + 1, cell.ColumnIndex - 1)));
                }

                if ((moveDir == MovingDirection.None || moveDir == MovingDirection.Down) &&
                    cell.RowIndex > mouseDownRange.Bottom && e.Location.Y > r.Bottom + r.Height / 2)
                {
                    moveDir = MovingDirection.Down;
                    Grid.Model.Selections.Clear();
                    Grid.Model.Selections.Add(mouseDownRange.UnionRange(GridRangeInfo.Cell(cell.RowIndex, mouseDownRange.Right)));
                    Grid.ScrollInView(new RowColumnIndex(Math.Min(Grid.Model.RowCount, cell.RowIndex + 1), cell.ColumnIndex));
                }
                else if ((moveDir == MovingDirection.None || moveDir == MovingDirection.Up) &&
                         cell.RowIndex < mouseDownRange.Top && e.Location.Y < r.Bottom - r.Height / 2)
                {
                    moveDir = MovingDirection.Up;
                    Grid.Model.Selections.Clear();
                    Grid.Model.Selections.Add(mouseDownRange.UnionRange(GridRangeInfo.Cell(cell.RowIndex, mouseDownRange.Right)));
                    Grid.ScrollInView(new RowColumnIndex(Math.Max(Grid.Model.FrozenRows + 1, cell.RowIndex - 1), cell.ColumnIndex));
                }
                else if ((moveDir == MovingDirection.None || moveDir == MovingDirection.Right) &&
                         cell.ColumnIndex > mouseDownRange.Right && e.Location.X > r.Right + r.Width / 2)
                {
                    moveDir = MovingDirection.Right;
                    Grid.Model.Selections.Clear();
                    Grid.Model.Selections.Add(mouseDownRange.UnionRange(GridRangeInfo.Cell(cell.RowIndex, cell.ColumnIndex)));
                    Grid.ScrollInView(new RowColumnIndex(cell.RowIndex, Math.Min(Grid.Model.ColumnCount, cell.ColumnIndex + 1)));
                }
                else if ((moveDir == MovingDirection.None || moveDir == MovingDirection.Left) &&
                         cell.ColumnIndex < mouseDownRange.Left && e.Location.X < r.Right - r.Width / 2)
                {
                    if (cell.RowIndex >= mouseDownRange.Top && cell.RowIndex <= mouseDownRange.Bottom)
                    {
                        moveDir = MovingDirection.Left;
                        Grid.Model.Selections.Clear();
                        Grid.Model.Selections.Add(mouseDownRange.UnionRange(GridRangeInfo.Cell(cell.RowIndex, cell.ColumnIndex)));
                        Grid.ScrollInView(new RowColumnIndex(cell.RowIndex, Math.Max(Grid.Model.FrozenColumns + 1, cell.ColumnIndex - 1)));
                    }
                }
            }
        }