private void button1_Click(object sender, EventArgs e)
 {
     if (comboBox1.Text == "Circle")
     {
         CircleForm circle = new CircleForm(Convert.ToInt32(radiustextbox.Text));
         circle.Show();
     }
     else if (comboBox1.Text == "Rectangle")
     {
         RectangleForm rectangle = new RectangleForm(Convert.ToInt32(edge1textbox.Text), Convert.ToInt32(edge2textbox.Text));
         rectangle.Show();
     }
     else
     {
         return;
     }
 }
示例#2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try {
         if (comboBox1.Text == "Circle")
         {
             this.Hide();
             CircleForm cf = new CircleForm((int.Parse(RadiusTextBox.Text) * 2) + 10);
             cf.Closed += (s, args) => this.Close();
             cf.Show();
         }
         if (comboBox1.Text == "Rectangle")
         {
             this.Hide();
             RectangleForm rf = new RectangleForm(int.Parse(Edge1TextBox.Text), int.Parse(Edge2TextBox.Text));
             rf.Closed += (s, args) => this.Close();
             rf.Show();
         }
     }
     catch (FormatException exception) {
         MessageBox.Show(exception.Message);
         this.Show();
     }
 }