private void addFishButton_Click(object sender, EventArgs e) { Rectangle fishTankRect = fishTankPanel.Bounds; Random random = new Random(); int x = random.Next(10, fishTankRect.Width - 20); int y = random.Next(10, fishTankRect.Height - 10); Fish fish = new Fish(fishComboBox.SelectedItem.ToString(), x, y, Color.FromName(colorsComboBox.SelectedItem.ToString())); _fishTank.AddFish(fish); fishTankPanel.Invalidate(); }
public void AddFish(Fish fish) { _fishTank.Add(fish); }