Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();

            guys[0] = new Guy() { Money = 100, Name = "Joe", MyLabel= lblJoe, MyRadioButton = radioJoe };
            guys[1] = new Guy() { Money = 100, Name = "Bob", MyLabel = lblBob, MyRadioButton = radioBob };
            guys[2] = new Guy() { Money = 100, Name = "Al", MyLabel = lblAl, MyRadioButton = radioAl };
            foreach(Guy guy in guys)
                guy.PlaceBet(0, 0);

            //set the default bet name to Joe
            lblName.Text = guys[0].Name;

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

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

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

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

            updateForm();
        }