Пример #1
0
        private void ChangeHeadColorsTo(ColorType color)
        {
            switch (color)
            {
            case ColorType.Red:
                Head = new RedHead();
                break;

            case ColorType.Green:
                Head = new GreenHead();
                break;

            case ColorType.Blue:
                Head = new BlueHead();
                break;
            }
        }
Пример #2
0
        private void typeduck_SelectedIndexChanged(object sender, EventArgs e)
        {
            dis();
            Iduck iduck;

            switch (typeduck.SelectedIndex)
            {
            case 0:
                iduck = new Mallard();
                iduck.TypeDuck(lblQ, lblfly, lblN, duckPic);

                break;

            case 1:
            {
                iduck = new Toy();
                iduck.TypeDuck(lblQ, lblfly, lblN, duckPic);
                break;
            }

            case 2:
                iduck = new Decoy();

                iduck.TypeDuck(lblQ, lblfly, lblN, duckPic);
                break;

            case 3:
                iduck = new Rubber();
                iduck.TypeDuck(lblQ, lblfly, lblN, duckPic);
                break;

            case 4:
                iduck = new RedHead();
                iduck.TypeDuck(lblQ, lblfly, lblN, duckPic);
                break;
            }
        }