Beispiel #1
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Width  += 10;
            Height += Heights.Get(comboBox1.SelectedItem.ToString());
            string s = comboBox1.SelectedItem.ToString();

            switch (s)
            {
            case "CompStmt":
                VisualStatement = new CompStmtUC();
                break;

            case "AssignStmt":
                VisualStatement = new AssignStmtUC();
                break;

            case "PrintStmt":
                VisualStatement = new PrintStmtUC();
                break;

            case "NewStmt":
                VisualStatement = new NewStmtUC();
                break;

            case "IfStmt":
                VisualStatement = new IfStmtUC();
                break;

            case "WhileStmt":
                VisualStatement = new WhileStmtUC();
                break;

            case "WHStmt":
                VisualStatement = new WHUC();
                break;

            case "ForkStmt":
                VisualStatement = new ForkUC();
                break;

            case "SkipStmt":
                VisualStatement = new SkipStmtUC();
                break;
            }
            comboBox1.Enabled = false;
            Controls.Add((Control)VisualStatement);
            ((Control)VisualStatement).Left = 10;
            ((Control)VisualStatement).Top  = 50;
        }
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            Width  += 10;
            Height += Heights.Get(comboBox2.SelectedItem.ToString());
            string s = comboBox2.SelectedItem.ToString();

            H = H + Heights.Get(s);
            switch (s)
            {
            case "ConstExp":
                Exp2 = new ConstExpUC();
                break;

            case "ArithExp":
                Exp2 = new ArithExpUC();
                break;

            case "LogicalOp":
                Exp2 = new LogicalOpUC();;
                break;

            case "VarExp":
                Exp2 = new VarExpUC();
                break;

            case "RelationalOp":
                Exp2 = new RelationalOpUC();
                break;

            case "rH":
                Exp2 = new rHUC();
                break;
            }
            comboBox2.Enabled = false;
            this.Controls.Add((Control)Exp2);
            ((Control)Exp2).Left = 10;
            ((Control)Exp2).Top  = 60 + Heights.Get(comboBox1.SelectedItem.ToString()) + Exp1.H;
        }