Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            TrapeziaArea myclass = new TrapeziaArea();        //實例化類別物件

            myclass.SD     = Convert.ToDouble(textBox1.Text); //為梯形的上底賦值
            myclass.XD     = Convert.ToDouble(textBox2.Text); //為梯形的下底賦值
            myclass.Height = Convert.ToDouble(textBox3.Text); //為梯形的高賦值
            textBox4.Text  = myclass.Area().ToString();       //計算梯形面積
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            TrapeziaArea myclass = new TrapeziaArea();        //实例化类对象

            myclass.SD     = Convert.ToDouble(textBox1.Text); //为梯形的上底赋值
            myclass.XD     = Convert.ToDouble(textBox2.Text); //为梯形的下底赋值
            myclass.Height = Convert.ToDouble(textBox3.Text); //为梯形的高赋值
            textBox4.Text  = myclass.Area().ToString();       //计算梯形面积
        }