Exemple #1
0
        public Form1()
        {
            InitializeComponent();

            GreyhoundArray[0] = new Greyhound() { MyPictureBox = pictureBox2, StartingPosition = pictureBox2.Left, RacetrackLength = racetrackPictureBox.Width - pictureBox2.Width, Randomizer = MyRandomizer };
            GreyhoundArray[1] = new Greyhound() { MyPictureBox = pictureBox3, StartingPosition = pictureBox3.Left, RacetrackLength = racetrackPictureBox.Width - pictureBox3.Width, Randomizer = MyRandomizer };
            GreyhoundArray[2] = new Greyhound() { MyPictureBox = pictureBox4, StartingPosition = pictureBox4.Left, RacetrackLength = racetrackPictureBox.Width - pictureBox4.Width, Randomizer = MyRandomizer };
            GreyhoundArray[3] = new Greyhound() { MyPictureBox = pictureBox5, StartingPosition = pictureBox5.Left, RacetrackLength = racetrackPictureBox.Width - pictureBox5.Width, Randomizer = MyRandomizer };

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

            minimumBetLabel.Text = "Minimum Bet: " + betAmountLabel.Minimum + " bucks";
        }
Exemple #2
0
        public Form1()
        {
            InitializeComponent();

            racers = new Greyhound[4];
            bettors = new Guy[3];

            racers[0] = new Greyhound()
            {
                MyPictureBox = pictureBox1,
                StartingPosition = pictureBox1.Left,
                RacetrackLength = racetrackPictureBox.Width - pictureBox1.Width,
                Randomizer = MyRandomizer
            };

            racers[1] = new Greyhound()
            {
                MyPictureBox = pictureBox2,
                StartingPosition = pictureBox2.Left,
                RacetrackLength = racetrackPictureBox.Width - pictureBox2.Width,
                Randomizer = MyRandomizer
            };

            racers[2] = new Greyhound()
            {
                MyPictureBox = pictureBox3,
                StartingPosition = pictureBox3.Left,
                RacetrackLength = racetrackPictureBox.Width - pictureBox3.Width,
                Randomizer = MyRandomizer
            };

            racers[3] = new Greyhound()
            {
                MyPictureBox = pictureBox4,
                StartingPosition = pictureBox4.Left,
                RacetrackLength = racetrackPictureBox.Width - pictureBox4.Width,
                Randomizer = MyRandomizer
            };

            bettors[0] = new Guy()
            {
                Name = "Joe",
                Cash = 100,
                MyLabel = joeLabel,
                MyRadioButton = joeRadioButton,
                MyBet = null
            };

            bettors[1] = new Guy()
            {
                Name = "Bob",
                Cash = 100,
                MyLabel = bobLabel,
                MyRadioButton = bobRadioButton,
                MyBet = null
            };

            bettors[2] = new Guy()
            {
                Name = "Al",
                Cash = 100,
                MyLabel = alLabel,
                MyRadioButton = alRadioButton,
                MyBet = null
            };

            for(int i = 0; i < bettors.Length; i++)
            {
                bettors[i].ClearBet();
                bettors[i].UpdateLabels();
            }
        }