Beispiel #1
0
        public Form1()
        {
            InitializeComponent();
            joeRadioButton.Checked = true;
            // initialize minimum bet label
            minimumBetLabel.Text = "Minimum Bet : " + numericUpDown1.Minimum.ToString() + " pounds";

            // initialize all 4 elements of the GreyhoundArray
            GreyhoundArray[0] = new Greyhound()
            {
                MyPictureBox     = pictureBox1,
                StartingPosition = pictureBox1.Left,
                RaceTrackLenght  = racetrackPicturebox.Width - pictureBox1.Width,
                Randomizer       = MyRandomizer
            };

            GreyhoundArray[1] = new Greyhound()
            {
                MyPictureBox     = pictureBox2,
                StartingPosition = pictureBox2.Left,
                RaceTrackLenght  = racetrackPicturebox.Width - pictureBox2.Width,
                Randomizer       = MyRandomizer
            };

            GreyhoundArray[2] = new Greyhound()
            {
                MyPictureBox     = pictureBox3,
                StartingPosition = pictureBox3.Left,
                RaceTrackLenght  = racetrackPicturebox.Width - pictureBox3.Width,
                Randomizer       = MyRandomizer
            };

            GreyhoundArray[3] = new Greyhound()
            {
                MyPictureBox     = pictureBox4,
                StartingPosition = pictureBox4.Left,
                RaceTrackLenght  = racetrackPicturebox.Width - pictureBox4.Width,
                Randomizer       = MyRandomizer
            };

            //initialize all 3 elements of the GuysArray
            GuysArray[0] = new Guy()
            {
                Name          = "Joe",
                MyBet         = null,
                Cash          = 50,
                MyRadioButton = joeRadioButton,
                MyLabel       = joeBetLabel
            };

            GuysArray[1] = new Guy()
            {
                Name          = "Bob",
                MyBet         = null,
                Cash          = 75,
                MyRadioButton = bobRadioButton,
                MyLabel       = bobBetLabel
            };

            GuysArray[2] = new Guy()
            {
                Name          = "Al",
                MyBet         = null,
                Cash          = 45,
                MyRadioButton = alRadioButton,
                MyLabel       = alBetLabel
            };

            for (int i = 0; i <= 2; i++)
            {
                GuysArray[i].UpdateLabels();
                GuysArray[i].MyBet = new Bet();
            }
        }