Beispiel #1
0
        public Form1()
        {
            InitializeComponent();
            for (int i = 0; i < 3; i++)
            {
                bettors[i] = new Guy();
            }
            for (int i = 0; i < 4; i++)
            {
                dogs[i] = new Greyhound();
            }
            CurrentBettor = bettors[0];
            bettors[0].Name = "Joe";
            bettors[0].MyRadioButton = JoeRadioButton;
            bettors[0].MyLabel = JoeBetLabel;
            bettors[0].Cash = 50;

            bettors[1].Name = "Bob";
            bettors[1].MyRadioButton = BobRadioButton;
            bettors[1].MyLabel = BobBetLabel;
            bettors[1].Cash = 75;

            bettors[2].Name = "Al";
            bettors[2].MyRadioButton = AlRadioButton;
            bettors[2].MyLabel = AlBetLabel;
            bettors[2].Cash = 45;

            JoeRadioButton.Checked = true;

            dogs[0].MyPictureBox = PicBxDog1;
            dogs[0].RacetrackLength = PicBxRacetrack.Width - dogs[0].MyPictureBox.Size.Width;
            dogs[0].StartingPositon = dogs[0].MyPictureBox.Location.X;
            dogs[0].Location = dogs[0].StartingPositon;
            dogs[0].Randomizer = my_Randomizer;

            dogs[1].MyPictureBox = PicBxDog2;
            dogs[1].RacetrackLength = PicBxRacetrack.Width - dogs[1].MyPictureBox.Size.Width;
            dogs[1].StartingPositon = dogs[1].MyPictureBox.Location.X;
            dogs[1].Location = dogs[1].StartingPositon;
            dogs[1].Randomizer = my_Randomizer;

            dogs[2].MyPictureBox = PicBxDog3;
            dogs[2].RacetrackLength = PicBxRacetrack.Width - dogs[2].MyPictureBox.Size.Width;
            dogs[2].StartingPositon = dogs[2].MyPictureBox.Location.X;
            dogs[2].Location = dogs[2].StartingPositon;
            dogs[2].Randomizer = my_Randomizer;

            dogs[3].MyPictureBox = PicBxDog4;
            dogs[3].RacetrackLength = PicBxRacetrack.Width - dogs[3].MyPictureBox.Size.Width;
            dogs[3].StartingPositon = dogs[3].MyPictureBox.Location.X;
            dogs[3].Location = dogs[3].StartingPositon;
            dogs[3].Randomizer = my_Randomizer;

            MinBetLabel.Text += ": " + BetAmountNumericUpDown1.Minimum + " bucks";
            for (int i = 0; i < 3; i++)
            {
                bettors[i].MyRadioButton.Text = bettors[i].Name + " has " + bettors[i].Cash + " bucks";
            }
        }
Beispiel #2
0
 private void AlRadioButton_CheckedChanged(object sender, EventArgs e)
 {
     BettorLabel.Text = bettors[2].Name;
     CurrentBettor = bettors[2];
 }