protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
//verifico che l'eventuale edit sia terminato altrimenti esco
if (Selection.ActivePosition.IsEmpty() == false)
{
CellContext focusCell = new CellContext(this, Selection.ActivePosition);
if (focusCell.Cell != null && focusCell.IsEditing())
{
if (focusCell.EndEdit(false) == false)
return;
}
}
//scateno eventi di MouseDown
Position position = PositionAtPoint(new Point(e.X, e.Y));
if (position.IsEmpty() == false)
{
Cells.ICellVirtual cellMouseDown = GetCell(position);
if (cellMouseDown != null)
{
ChangeMouseDownCell(position, position);
//Cell.OnMouseDown
CellContext cellContext = new CellContext(this, position, cellMouseDown);
Controller.OnMouseDown(cellContext, e);
}
}
else
ChangeMouseDownCell(Position.Empty, Position.Empty);
}