コード例 #1
0
ファイル: Form1.cs プロジェクト: grismanss/IS_18
 private void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listBox1.SelectedIndex > -1)
     {
         if (listBox1.SelectedItem is Ozero)
         {
             Ozero o = listBox1.SelectedItem as Ozero;
             label4.Text = "T=" + o.Calc().ToString();
         }
         else if (listBox1.SelectedItem is Reka)
         {
             Reka o = listBox1.SelectedItem as Reka;
             label4.Text = "T=" + o.Calc().ToString();
         }
         else
         {
             Samosplav o = listBox1.SelectedItem as Samosplav;
             label4.Text = "T=" + o.Calc().ToString();
         }
     }
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: grismanss/IS_18
        private void Button1_Click(object sender, EventArgs e)
        {
            double s = Convert.ToDouble(textBox1.Text);

            if (radioButton1.Checked)
            {
                double v = Convert.ToDouble(textBox2.Text);
                Ozero  o = new Ozero(v, s);
                listBox1.Items.Add(o);
            }
            else if (radioButton2.Checked)
            {
                double v = Convert.ToDouble(textBox2.Text);
                double w = Convert.ToDouble(textBox3.Text);
                Reka   r = new Reka(v, w, s);
                listBox1.Items.Add(r);
            }
            else
            {
                double    w  = Convert.ToDouble(textBox3.Text);
                Samosplav ss = new Samosplav(w, s);
                listBox1.Items.Add(ss);
            }
        }