private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { Width += 10; Height += Heights.Get(comboBox2.SelectedItem.ToString()); string s = (comboBox2.SelectedItem.ToString()); switch (s) { case "AssignStmt": Then = new AssignStmtUC(); break; case "CompStmt": Then = new CompStmtUC(); break; case "PrintStmt": Then = new PrintStmtUC(); break; case "NewStmt": Then = new NewStmtUC(); break; case "IfStmt": Then = new IfStmtUC(); break; } comboBox2.Enabled = false; this.Controls.Add((Control)Then); ((Control)Then).Left = 10; ((Control)Then).Top = 60 + 190; }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { Width += 10; panel1.Width += 10; Height += Heights.Get(comboBox1.SelectedItem.ToString()); string s = (comboBox1.SelectedItem.ToString()); switch (s) { case "AssignStmt": First = new AssignStmtUC(); break; case "CompStmt": First = new CompStmtUC(); break; case "PrintStmt": First = new PrintStmtUC(); break; case "NewStmt": First = new NewStmtUC(); break; case "IfStmt": First = new IfStmtUC(); break; case "WhileStmt": First = new WhileStmtUC(); break; case "WHStmt": First = new WHUC(); break; case "ForkStmt": First = new ForkUC(); break; case "SkipStmt": First = new SkipStmtUC(); break; } panel1.Controls.Add((Control)First); ((Control)First).Left = 10; ((Control)First).Top = 50; comboBox1.Enabled = false; }