Esempio n. 1
0
 private void joeRadio_CheckedChanged(object sender, EventArgs e)
 {
     Bettor = guys[0];
     bettorLabel.Text = Bettor.Name;
 }
Esempio n. 2
0
        private void setupRaceTrack()
        {
            dogs = new Greyhound[4];
            guys = new Guy[3];

            int startingPosition = dog1PictureBox.Right - racetrackPictureBox.Left;

            dogs[0] = new Greyhound { MyPictureBox = dog1PictureBox, StartingPosition = startingPosition };
            dogs[1] = new Greyhound { MyPictureBox = dog2PictureBox, StartingPosition = startingPosition };
            dogs[2] = new Greyhound { MyPictureBox = dog3PictureBox, StartingPosition = startingPosition };
            dogs[3] = new Greyhound { MyPictureBox = dog4PictureBox, StartingPosition = startingPosition };

            guys[0] = new Guy { Name = "Joe", Cash = 50, MyBet = null, MyLabel = joeBetLabel,
                MyRadioButton = joeRadio };
            guys[0].UpdateLabels();
            guys[1] = new Guy { Name = "Bob", Cash = 75, MyBet = null, MyLabel = bobBetLabel,
                MyRadioButton = bobRadio };
            guys[1].UpdateLabels();
            guys[2] = new Guy { Name = "Al", Cash = 45, MyBet = null, MyLabel = alBetLabel,
                MyRadioButton = alRadio };
            guys[2].UpdateLabels();

            // This ensures that when the dog's nose hits the end of the track, it wins
            //            Greyhound.RacetrackLength = racetrackPictureBox.Width - dog1PictureBox.Width;
            Greyhound.RacetrackLength = racetrackPictureBox.Width;
            Greyhound.Randomizer = new Random();
        }