Esempio n. 1
0
        private void cbAnswerType_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                type1.Dispose();
                type2.Dispose();
                type3.Dispose();
                type4.Dispose();
                type5.Dispose();
                type6.Dispose();
                Point        point  = new Point(250, richTextBox1.Size.Height + lower);
                AnchorStyles anchor = AnchorStyles.Bottom | AnchorStyles.Left;
                setRtbLocation();
                switch (cbAnswerType.SelectedIndex)
                {
                case 0:
                    type1 = new Type1();
                    Controls.Add(type1);
                    type1.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower);
                    type1.Anchor   = anchor;
                    break;

                case 1:
                    type2 = new Type2();
                    Controls.Add(type2);
                    type2.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower);
                    type2.Anchor   = anchor;
                    break;

                case 2:
                    type3 = new Type3();
                    Controls.Add(type3);
                    type3.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower);
                    type3.Anchor   = anchor;
                    break;

                case 3:
                    type4 = new Type4();
                    Controls.Add(type4);
                    type4.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower);
                    type4.Anchor   = anchor;
                    break;

                case 4:
                    type5 = new Type5();
                    Controls.Add(type5);
                    type5.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower);
                    type5.Anchor   = anchor;
                    break;

                case 5:
                    type6 = new Type6();
                    Controls.Add(type6);
                    type6.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower);
                    type6.Anchor   = anchor;
                    break;

                default:
                    break;
                }
            }
            catch
            {
                // Druga próba rekursywnie.
                cbAnswerType_SelectedIndexChanged(sender, e);
            }
        }