Exemplo n.º 1
0
        protected virtual void grid_MouseMove(GridVirtual sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left && sender.Selection.EnableMultiSelection)
            {
                //Scroll if necesary
                sender.ScrollOnPoint(e.Location);



                Position           pointPosition = sender.PositionAtPoint(e.Location);
                Cells.ICellVirtual cellPosition  = sender.GetCell(pointPosition);

                //Only if there is a FocusCell
                CellContext focusCellContext = new CellContext(sender, sender.Selection.ActivePosition);
                if (focusCellContext.Cell != null && focusCellContext.IsEditing() == false)
                {
                    Position           selCornerPos = pointPosition;
                    Cells.ICellVirtual selCorner    = cellPosition;

                    ////If the current Focus Cell is a scrollable cell then search the current cell (under the mouse)only in scrollable cells
                    //// see PositionAtPoint with false parameter
                    //if (sender.GetPositionType(sender.Selection.ActivePosition) == CellPositionType.Scrollable)
                    //{
                    //    selCornerPos = sender.PositionAtPoint(new Point(e.X, e.Y));
                    //    selCorner = sender.GetCell(pointPosition);
                    //}

                    if (selCornerPos.IsEmpty() == false && selCorner != null)
                    {
                        //Only if the user start the selection with a cell (m_MouseDownCell!=null)
                        if (sender.MouseDownPosition.IsEmpty() == false && sender.Selection.IsSelectedCell(sender.MouseDownPosition))
                        {
                            sender.ChangeMouseSelectionCorner(selCornerPos);
                            //sender.ShowCell(l_SelCornerPos);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
		protected virtual void grid_MouseMove(GridVirtual sender, System.Windows.Forms.MouseEventArgs e)
		{
			if (e.Button == MouseButtons.Left && sender.Selection.EnableMultiSelection)
			{
                //Scroll if necesary
                sender.ScrollOnPoint(e.Location);



                Position pointPosition = sender.PositionAtPoint(e.Location);
                Cells.ICellVirtual cellPosition = sender.GetCell(pointPosition);

				//Only if there is a FocusCell
				CellContext focusCellContext = new CellContext(sender, sender.Selection.ActivePosition);
				if (focusCellContext.Cell != null && focusCellContext.IsEditing() ==false)
				{
                    Position selCornerPos = pointPosition;
                    Cells.ICellVirtual selCorner = cellPosition;

                    ////If the current Focus Cell is a scrollable cell then search the current cell (under the mouse)only in scrollable cells
                    //// see PositionAtPoint with false parameter
                    //if (sender.GetPositionType(sender.Selection.ActivePosition) == CellPositionType.Scrollable)
                    //{
                    //    selCornerPos = sender.PositionAtPoint(new Point(e.X, e.Y));
                    //    selCorner = sender.GetCell(pointPosition);
                    //}

                    if (selCornerPos.IsEmpty() == false && selCorner != null)
					{
						//Only if the user start the selection with a cell (m_MouseDownCell!=null)
						if (sender.MouseDownPosition.IsEmpty() == false && sender.Selection.IsSelectedCell(sender.MouseDownPosition))
						{
                            sender.ChangeMouseSelectionCorner(selCornerPos);
							//sender.ShowCell(l_SelCornerPos);
						}
					}
				}
			}
		}