예제 #1
0
        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();
        }
예제 #2
0
 public void AddFish(Fish fish)
 {
     _fishTank.Add(fish);
 }