コード例 #1
0
ファイル: Form1.cs プロジェクト: sreeshprakash/C_Sharp
        private void SetupRaceTrack()
        {
            MinimumBet.Text = string.Format("Minimum bet {0:c}", (int)BetAmount.Minimum);

            int startingPosition = dog1.Right - racetrack.Left;
            int raceTrackLength = racetrack.Size.Width;

            dogs[0] = new Greyhound() { MyPictureBox = dog1,
                                        RacetrackLength = raceTrackLength,
                                        StartingPosition = startingPosition };
            dogs[1] = new Greyhound() { MyPictureBox = dog2,
                                        RacetrackLength = raceTrackLength,
                                        StartingPosition = startingPosition };
            dogs[2] = new Greyhound() { MyPictureBox = dog3,
                                        RacetrackLength = raceTrackLength,
                                        StartingPosition = startingPosition };
            dogs[3] = new Greyhound() { MyPictureBox = dog4,
                                        RacetrackLength = raceTrackLength,
                                        StartingPosition = startingPosition };

            guys[0] = new Guy("Joe", null, 50, joeButton, joeBet);
            guys[1] = new Guy("Bob", null, 75, bobButton, bobBet);
            guys[2] = new Guy("Al", null, 45, alButton, alBet);

            foreach (Guy guy in guys) {
                guy.UpdateLabels();
            }
        }