public void SetKeyCell(Cell cell) { Cell cellFind = KeyCells.FirstOrDefault(record => record.Location.Equals(cell.Location)); if (cellFind == null) { this.KeyCells.Add(cell); MapBmpFillRectangle(cell, Color.DarkSlateBlue); } else { cellFind.Name = cell.Name; } }
public Cell GetKeyCell(int mouseX, int mouseY) { return(KeyCells.FirstOrDefault(record => record.Location.Equals(new Point(mouseX / this.CELL_WIDTH * CELL_WIDTH, mouseY / this.CELL_WIDTH * CELL_WIDTH)))); }
public string GetKeyCellName(int mouseX, int mouseY) { Cell cell = KeyCells.FirstOrDefault(record => record.Location.Equals(new Point(mouseX / this.CELL_WIDTH * CELL_WIDTH, mouseY / this.CELL_WIDTH * CELL_WIDTH))); return(cell == null ? string.Empty : cell.Name); }