protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (e.Button != MouseButtons.Right) { return; } if (e.X < _gridOffset.X || e.Y < _gridOffset.Y) { return; } _currentCell = new Vector2I((e.X - _gridOffset.X) / _cellSize.Width, (e.Y - _gridOffset.Y) / _cellSize.Height); var range = new Range2I(new Vector2I(), Content.GridSize); if (range.Contains(_currentCell)) { var slot = Content.PeekSlot(_currentCell); _contextMenu.Items[1].Enabled = slot != null; _contextMenu.Show(this, e.Location); } }