Esempio n. 1
0
        protected virtual void grid_MouseDown(GridVirtual sender, System.Windows.Forms.MouseEventArgs e)
        {
            //verifico che l'eventuale edit sia terminato altrimenti esco
            if (sender.Selection.ActivePosition.IsEmpty() == false)
            {
                CellContext focusCell = new CellContext(sender, sender.Selection.ActivePosition);
                if (focusCell.Cell != null && focusCell.IsEditing())
                {
                    if (focusCell.EndEdit(false) == false)
                    {
                        return;
                    }
                }
            }

            //scateno eventi di MouseDown
            Position position = sender.PositionAtPoint(new Point(e.X, e.Y));

            if (position.IsEmpty() == false)
            {
                Cells.ICellVirtual cellMouseDown = sender.GetCell(position);
                if (cellMouseDown != null)
                {
                    sender.ChangeMouseDownCell(position, position);

                    //Cell.OnMouseDown
                    CellContext cellContext = new CellContext(sender, position, cellMouseDown);
                    sender.Controller.OnMouseDown(cellContext, e);
                }
            }
            else
            {
                sender.ChangeMouseDownCell(Position.Empty, Position.Empty);
            }
        }
Esempio n. 2
0
		protected virtual void grid_MouseDown(GridVirtual sender, System.Windows.Forms.MouseEventArgs e)
		{
			//verifico che l'eventuale edit sia terminato altrimenti esco
			if (sender.Selection.ActivePosition.IsEmpty() == false)
			{
				CellContext focusCell = new CellContext(sender, sender.Selection.ActivePosition);
				if (focusCell.Cell != null && focusCell.IsEditing())
				{
					if (focusCell.EndEdit(false) == false)
						return;
				}
			}

			//scateno eventi di MouseDown
			Position position = sender.PositionAtPoint( new Point(e.X, e.Y) );
			if (position.IsEmpty() == false)
			{
				Cells.ICellVirtual cellMouseDown = sender.GetCell(position);
				if (cellMouseDown != null)
				{
					sender.ChangeMouseDownCell(position, position);

					//Cell.OnMouseDown
					CellContext cellContext = new CellContext(sender, position, cellMouseDown);
					sender.Controller.OnMouseDown(cellContext, e);
				}
			}
			else
				sender.ChangeMouseDownCell(Position.Empty, Position.Empty);
		}
Esempio n. 3
0
        protected virtual void grid_MouseUp(GridVirtual sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (sender.MouseDownPosition.IsEmpty() == false)
            {
                Cells.ICellVirtual l_MouseDownCell = sender.GetCell(sender.MouseDownPosition);
                if (l_MouseDownCell != null)
                {
                    sender.Controller.OnMouseUp(new CellContext(sender, sender.MouseDownPosition, l_MouseDownCell), e);
                }

                sender.ChangeMouseDownCell(Position.Empty, sender.PositionAtPoint(new Point(e.X, e.Y)));
            }
        }
Esempio n. 4
0
		protected virtual void grid_MouseUp(GridVirtual sender, System.Windows.Forms.MouseEventArgs e)
		{
			if (sender.MouseDownPosition.IsEmpty() == false)
			{
				Cells.ICellVirtual l_MouseDownCell = sender.GetCell(sender.MouseDownPosition);
				if (l_MouseDownCell!=null)
					sender.Controller.OnMouseUp(new CellContext(sender, sender.MouseDownPosition, l_MouseDownCell), e );

				sender.ChangeMouseDownCell(Position.Empty, sender.PositionAtPoint(new Point(e.X, e.Y)));
			}
		}