示例#1
0
        public Form1()
        {
            InitializeComponent();

            dogs[0] = new Greyhound() { MyPictureBox = this.pictureBoxDog0, RacetrackLength = pictureBoxTrack.Width - finishLineWidth - this.pictureBoxDog0.Width, StartingPosition = 25 };
            dogs[1] = new Greyhound() { MyPictureBox = this.pictureBoxDog1, RacetrackLength = pictureBoxTrack.Width - finishLineWidth - this.pictureBoxDog1.Width, StartingPosition = 25 };
            dogs[2] = new Greyhound() { MyPictureBox = this.pictureBoxDog2, RacetrackLength = pictureBoxTrack.Width - finishLineWidth - this.pictureBoxDog2.Width, StartingPosition = 25 };
            dogs[3] = new Greyhound() { MyPictureBox = this.pictureBoxDog3, RacetrackLength = pictureBoxTrack.Width - finishLineWidth - this.pictureBoxDog3.Width, StartingPosition = 25 };

            Random theRandomizer = new Random();
            for (int i = 0; i < dogs.Length; i++)
            {
                dogs[i].Randomizer = theRandomizer;
            }

            guys[0] = new Guy() { Name = "Joe", Cash = 100, MyLabel = this.labelJoeBet, MyRadioButton = this.radioButtonJoe, MyBet = null };
            guys[1] = new Guy() { Name = "Bob", Cash = 100, MyLabel = this.labelBobBet, MyRadioButton = this.radioButtonBob, MyBet = null };
            guys[2] = new Guy() { Name = "Mac", Cash = 100, MyLabel = this.labelMacBet, MyRadioButton = this.radioButtonMac, MyBet = null };

            guys[0].UpdateLabels();
            guys[1].UpdateLabels();
            guys[2].UpdateLabels();
        }