コード例 #1
0
ファイル: Form1.cs プロジェクト: shunnien/HeadFirstCsharp
        public Form1()
        {
            InitializeComponent();

            minimumBet.Text = string.Format("Minimum bet {0:c}", (int)betAmount.Minimum);
            for (int i = 0; i < dogs.Length; i++) {
                dogs[i] = new Greyhound() {
                    MyPictureBox = (PictureBox)Controls.Find(("dog" + (i+1).ToString()), false).FirstOrDefault(),
                    RacetrackLength = racetrack.Size.Width -(dog1.Right - racetrack.Left),
                    StartingPosition = dog1.Left
                };
            }

            guys = new Guy[3] {
                new Guy() { Name="Joe",MyBet=null,Cash=50,MyRadioButton = joeRadioButton,MyLabel=joeBet},
                new Guy() { Name="Bob",MyBet=null,Cash=75,MyRadioButton = bobRadioButton,MyLabel=bobBet},
                new Guy() { Name="Al",MyBet=null,Cash=45,MyRadioButton = alRadioButton,MyLabel=alBet}
            };

            foreach (var item in guys) {
                item.UpdateLabels();
            }
        }