All pastes #677299 Raw Edit

Someone

public text v1 · immutable
#677299 ·published 2007-08-31 21:43 UTC
rendered paste body
namespace newcalc
{
    public partial class Form1 : Form
    {
        double x1;
        double x2;
        double x3;
        double x4;
        double y1;
        double y2;
        double y3;
        double y4;
        bool x1if;
        bool x2if;
        bool x3if;
        bool x4if;
        bool y1if;
        bool y2if;
        bool y3if;
        bool y4if;
        Fraction x1fr;
        Fraction x2fr;
        Fraction x3fr;
        Fraction x4fr;
        Fraction y1fr;
        Fraction y2fr;
        Fraction y3fr;
        Fraction y4fr;
        double DAB;
        double DAC;
        double DBC;
        double DAD;
        double DBD;
        double DCD;

        string AngleA;
        string AngleB;
        string AngleC;
        string AngleD;
        string WhichLine;
        private void updateVariables()
        {
            try
            {
                if (label14.Visible == true)
                    label14.Visible = false;
                if (xBox1.Text.Length > 0)
                    x1 = double.Parse(xBox1.Text);
                if (xBox2.Text.Length > 0)
                    x2 = double.Parse(xBox2.Text);
                if (xBox3.Text.Length > 0)
                    x3 = double.Parse(xBox3.Text);
                if (xBox4.Text.Length > 0)
                    x4 = double.Parse(xBox4.Text);
                if (yBox1.Text.Length > 0)
                    y1 = double.Parse(yBox1.Text);
                if (yBox2.Text.Length > 0)
                    y2 = double.Parse(yBox2.Text);
                if (yBox3.Text.Length > 0)
                    y3 = double.Parse(yBox3.Text);
                if (yBox4.Text.Length > 0)
                    y4 = double.Parse(yBox4.Text);
            }
            catch (FormatException)
            {
                label14.Visible = true;
            }
        }
        public Form1()
        {
            InitializeComponent();
        }

        private void distanceLabel4_Click(object sender, EventArgs e)
        {
            setWorkLabels(x2, y2, x3, y3);
        }
        private void setMyVisibilities()
        {
            if (distanceLabel1.Visible == false)
                distanceLabel1.Visible = true;
            if (distanceLabel2.Visible == false && xBox3.Text.Length > 0)
                distanceLabel2.Visible = true;
            else if (distanceLabel2.Visible == true && xBox3.Text.Length == 0)
                distanceLabel2.Visible = false;
            if (distanceLabel3.Visible == false && xBox4.Text.Length > 0)
                distanceLabel3.Visible = true;
            else if (distanceLabel3.Visible == true && xBox4.Text.Length == 0)
                distanceLabel3.Visible = false;
            if (distanceLabel4.Visible == false && xBox3.Text.Length > 0)
                distanceLabel4.Visible = true;
            else if (distanceLabel4.Visible == true && xBox3.Text.Length == 0)
                distanceLabel4.Visible = false;
            if (distanceLabel5.Visible == false && xBox4.Text.Length > 0)
                distanceLabel5.Visible = true;
            else if (distanceLabel5.Visible == true && xBox4.Text.Length == 0)
                distanceLabel5.Visible = false;
            if (distanceLabel6.Visible == false && xBox4.Text.Length > 0)
                distanceLabel6.Visible = true;
            else if (distanceLabel6.Visible == true && xBox4.Text.Length == 0)
                distanceLabel6.Visible = false;
            if (midLabel1.Visible == false)
                midLabel1.Visible = true;
            if (midLabel2.Visible == false && xBox3.Text.Length > 0)
                midLabel2.Visible = true;
            else if (midLabel2.Visible == true && xBox3.Text.Length == 0)
                midLabel2.Visible = false;
            if (midLabel3.Visible == false && xBox4.Text.Length > 0)
                midLabel3.Visible = true;
            else if (midLabel3.Visible == true && xBox4.Text.Length == 0)
                midLabel3.Visible = false;
            if (midLabel4.Visible == false && xBox3.Text.Length > 0)
                midLabel4.Visible = true;
            else if (midLabel4.Visible == true && xBox3.Text.Length == 0)
                midLabel4.Visible = false;
            if (midLabel5.Visible == false && xBox4.Text.Length > 0)
                midLabel5.Visible = true;
            else if (midLabel5.Visible == true && xBox4.Text.Length == 0)
                midLabel5.Visible = false;
            if (midLabel6.Visible == false && xBox4.Text.Length > 0)
                midLabel6.Visible = true;
            else if (midLabel6.Visible == true && xBox4.Text.Length == 0)
                midLabel6.Visible = false;
            if (AB.Visible == false)
                AB.Visible = true;
            if (AC.Visible == false && xBox3.Text.Length > 0)
                AC.Visible = true;
            else if (AC.Visible == true && xBox3.Text.Length == 0)
                AC.Visible = false;
            if (BC.Visible == false && xBox3.Text.Length > 0)
                BC.Visible = true;
            else if (BC.Visible == true && xBox3.Text.Length == 0)
                BC.Visible = false;
            if (AD.Visible == false && xBox4.Text.Length > 0)
                AD.Visible = true;
            else if (AD.Visible == true && xBox4.Text.Length == 0)
                AD.Visible = false;
            if (BD.Visible == false && xBox4.Text.Length > 0)
                BD.Visible = true;
            else if (BD.Visible == true && xBox4.Text.Length == 0)
                BD.Visible = false;
            if (CD.Visible == false && xBox4.Text.Length > 0)
                CD.Visible = true;
            else if (CD.Visible == true && xBox4.Text.Length == 0)
                CD.Visible = false;
            if (AB1.Visible == false)
                AB1.Visible = true;
            if (AC1.Visible == false && xBox3.Text.Length > 0)
                AC1.Visible = true;
            else if (AC1.Visible == true && xBox3.Text.Length == 0)
                AC1.Visible = false;
            if (BC1.Visible == false && xBox3.Text.Length > 0)
                BC1.Visible = true;
            else if (BC1.Visible == true && xBox3.Text.Length == 0)
                BC1.Visible = false;
            if (AD1.Visible == false && xBox4.Text.Length > 0)
                AD1.Visible = true;
            else if (AD1.Visible == true && xBox4.Text.Length == 0)
                AD1.Visible = false;
            if (BD1.Visible == false && xBox4.Text.Length > 0)
                BD1.Visible = true;
            else if (BD1.Visible == true && xBox4.Text.Length == 0)
                BD1.Visible = false;
            if (CD1.Visible == false && xBox4.Text.Length > 0)
                CD1.Visible = true;
            else if (CD1.Visible == true && xBox4.Text.Length == 0)
                CD1.Visible = false;
            if (slopeLabel1.Visible == false)
                slopeLabel1.Visible = true;
            if (slopeLabel2.Visible == false && xBox3.Text.Length > 0)
                slopeLabel2.Visible = true;
            else if (slopeLabel2.Visible == true && xBox3.Text.Length == 0)
                slopeLabel2.Visible = false;
            if (slopeLabel3.Visible == false && xBox3.Text.Length > 0)
                slopeLabel3.Visible = true;
            else if (slopeLabel3.Visible == true && xBox3.Text.Length == 0)
                slopeLabel3.Visible = false;
            if (slopeLabel4.Visible == false && xBox4.Text.Length > 0)
                slopeLabel4.Visible = true;
            else if (slopeLabel4.Visible == true && xBox4.Text.Length == 0)
                slopeLabel4.Visible = false;
            if (slopeLabel5.Visible == false && xBox4.Text.Length > 0)
                slopeLabel5.Visible = true;
            else if (slopeLabel5.Visible == true && xBox4.Text.Length == 0)
                slopeLabel5.Visible = false;
            if (slopeLabel6.Visible == false && xBox4.Text.Length > 0)
                slopeLabel6.Visible = true;
            else if (slopeLabel6.Visible == true && xBox4.Text.Length == 0)
                slopeLabel6.Visible = false;
        }
        private void setWorkVisibilities()
        {
            if (workLabel1.Visible == false)
                workLabel1.Visible = true;
            if (workLabel2.Visible == false)
                workLabel2.Visible = true;
            if (workLabel3.Visible == false)
                workLabel3.Visible = true;
            if (workLabel4.Visible == false)
                workLabel4.Visible = true;
            if (workLabel5.Visible == false)
                workLabel5.Visible = true;
            if (workLabel6.Visible == false)
                workLabel6.Visible = true;
        }
        private void killWorkVisibilities()
        {
            if (workLabel1.Visible == true)
                workLabel1.Visible = false;
            if (workLabel2.Visible == true)
                workLabel2.Visible = false;
            if (workLabel3.Visible == true)
                workLabel3.Visible = false;
            if (workLabel4.Visible == true)
                workLabel4.Visible = false;
            if (workLabel5.Visible == true)
                workLabel5.Visible = false;
            if (workLabel6.Visible == true)
                workLabel6.Visible = false;
        }
        private double MidpointDecimalX(double x1, double x2)
        {
            return (x1 + x2) / 2;
        }
        private double MidpointDecimalY(double y1, double y2)
        {
            return (y1 + y2) / 2;
        }
        private string Slope(double x1, double y1, double x2, double y2)
        {
            return (y2 - y1) + "/" + (x2 - x1) + " or " + ((y2 - y1) / (x2 - x1));
        }
        private void buttonCalculate_Click(object sender, EventArgs e)
        {
            setMyVisibilities();
            killWorkVisibilities();
            updateVariables();
            distanceLabel1.Text = DistanceDecimal(x1, y1, x2, y2) + " or Sqrt(" + DistanceRoot(x1, y1, x2, y2) + ")";
            if (xBox3.Text.Length > 0 && yBox3.Text.Length > 0)
                distanceLabel2.Text = DistanceDecimal(x1, y1, x3, y3) + " or Sqrt(" + DistanceRoot(x1, y1, x3, y3) + ")";
            if (xBox4.Text.Length > 0 && yBox4.Text.Length > 0)
                distanceLabel3.Text = DistanceDecimal(x1, y1, x4, y4) + " or Sqrt(" + DistanceRoot(x1, y1, x4, y4) + ")";
            if (xBox3.Text.Length > 0 && yBox3.Text.Length > 0)
                distanceLabel4.Text = DistanceDecimal(x2, y2, x3, y3) + " or Sqrt(" + DistanceRoot(x2, y2, x3, y3) + ")";
            if (xBox4.Text.Length > 0 && yBox4.Text.Length > 0)
                distanceLabel5.Text = DistanceDecimal(x2, y2, x4, y4) + " or Sqrt(" + DistanceRoot(x2, y2, x4, y4) + ")";
            if (xBox4.Text.Length > 0 && yBox4.Text.Length > 0)
                distanceLabel6.Text = DistanceDecimal(x3, y3, x4, y4) + " or Sqrt(" + DistanceRoot(x3, y3, x4, y4) + ")";
            midLabel1.Text = "(" + MidpointDecimalX(x1, x2) + "," + MidpointDecimalY(y1, y2) + ")";
            midLabel2.Text = "(" + MidpointDecimalX(x1, x3) + "," + MidpointDecimalY(y1, y3) + ")";
            midLabel3.Text = "(" + MidpointDecimalX(x1, x4) + "," + MidpointDecimalY(y1, y4) + ")";
            midLabel4.Text = "(" + MidpointDecimalX(x2, x3) + "," + MidpointDecimalY(y2, y3) + ")";
            midLabel5.Text = "(" + MidpointDecimalX(x2, x4) + "," + MidpointDecimalY(y2, y4) + ")";
            midLabel6.Text = "(" + MidpointDecimalX(x3, x4) + "," + MidpointDecimalY(y3, y4) + ")";
            slopeLabel1.Text = Slope(x1, y1, x2, y2);
            slopeLabel2.Text = Slope(x1, y1, x3, y3);
            slopeLabel3.Text = Slope(x1, y1, x4, y4);
            slopeLabel4.Text = Slope(x2, y2, x3, y3);
            slopeLabel5.Text = Slope(x2, y2, x4, y4);
            slopeLabel6.Text = Slope(x3, y3, x4, y4);
            if (xBox3.Text.Length > 0 && yBox3.Text.Length > 0 && xBox4.Text.Length == 0 && yBox4.Text.Length == 0)
            {
                if (TriangleHasRightAngle())
                {
                    areaLabel1.Text = GetRightTriangleArea().ToString();
                    polygonType1.Text = "Right Triangle";
                    setLineDistVars(true, false);
                    setRTAngles();
                    angleLabel1.Text = "Angle A: " + AngleA.ToString();
                    angleLabel2.Text = "Angle B: " + AngleB.ToString();
                    angleLabel3.Text = "Angle C: " + AngleC.ToString();
                }
                else if (!TriangleHasRightAngle())
                {
                    perimeterLabel1.Text = Math.Pow(DistanceDecimal(x1, y1, x2, y2), 2).ToString();
                    polygonType1.Text = Math.Pow(DistanceDecimal(x1, y1, x3, y3), 2).ToString();
                }
            }
        }
        private void setRTAngles()
        {
            if (WhichLine.Equals("AB"))
            {
                AngleC = "Math.Acos(" + DAC + " / " + DAB + ")";
                AngleA = "Math.Asin(" + DBC + " / " + DAB + ")";
                AngleB = "Math.Asin(" + DAC + " / " + DAB + ")";
                double shitfucker = (DAC / DAB);
                angleLabel4.Text = Math.Acos(shitfucker).ToString();
            }
            if (WhichLine.Equals("AC"))
            {
                AngleB = "Math.Acos(" + DAB + " / " + DAC + ")";
                AngleA = "Math.Sin(" + DBC + " / " + DAC + ")";
                AngleC = "Math.Sin(" + DAB + " / " + DAC + ")";
                double shitfucker = 1;
                angleLabel4.Text = Math.Acos(shitfucker).ToString();
            }
            if (WhichLine.Equals("BC"))
            {
                AngleA = "Math.Acos(" + DAB + " / " + DBC + ")";
                AngleB = "Math.Asin(" + DAC + " / " + DBC + ")";
                AngleC = "Math.Asin(" + DAB + " / " + DBC + ")";
                double shitfucker = (DAB / DBC);
                angleLabel4.Text = Math.Acos(shitfucker).ToString();
            }
        }
        private bool TriangleIsAcute()
        {
            if (WhichLine.Equals("AB"))
            {
                if (Math.Pow(DAB, 2) < Math.Pow(DAC, 2) + Math.Pow(DBC, 2))
                    return true;
            }
            if (WhichLine.Equals("AC"))
            {
                if (Math.Pow(DAC, 2) < Math.Pow(DAB, 2) + Math.Pow(DBC, 2))
                    return true;
            }
            if (WhichLine.Equals("BC"))
            {
                if (Math.Pow(DBC, 2) < Math.Pow(DAB, 2) + Math.Pow(DAC, 2))
                    return true;
            }
            return false;
        }
        private double GetRightTriangleArea()
        {
            double AB = DistanceDecimal(x1, y1, x2, y2);
            double AC = DistanceDecimal(x1, y1, x3, y3);
            double BC = DistanceDecimal(x2, y2, x3, y3);
            if (AB > AC && AB > BC)
                return (AC * BC * 0.5);
            if (AC > AB && AC > BC)
                return (AB * BC * 0.5);
            if (BC > AB && BC > AC)
                return (AB * AC * 0.5);
            return 0;
        }
        private void setLineDistVars(bool Tri, bool Quad)
        {
            if (Tri)
            {
                DAB = DistanceDecimal(x1, y1, x2, y2);
                DAC = DistanceDecimal(x1, y1, x3, y3);
                DBC = DistanceDecimal(x2, y2, x3, y3);
            }
            if (Quad)
            {
                DAB = DistanceDecimal(x1, y1, x2, y2);
                DAC = DistanceDecimal(x1, y1, x3, y3);
                DBC = DistanceDecimal(x2, y2, x3, y3);
                DAD = DistanceDecimal(x1, y1, x4, y4);
                DBD = DistanceDecimal(x2, y2, x4, y4);
                DCD = DistanceDecimal(x3, y3, x4, y4);
            }
        }
        private bool TriangleHasRightAngle()
        {
            /* Needed a damned fudge factor, damn long decimals */
            setLineDistVars(true, false);
            if (Math.Abs(Math.Pow(DAB, 2) + Math.Pow(DAC, 2) - Math.Pow(DBC, 2)) < 0.01)
            {
                WhichLine = "BC";
                return true;
            }
            if (Math.Abs(Math.Pow(DAB, 2) + Math.Pow(DBC, 2) - Math.Pow(DAC, 2)) < 0.01)
            {
                WhichLine = "AC";
                return true;
            }
            if (Math.Abs(Math.Pow(DAC, 2) + Math.Pow(DBC, 2) - Math.Pow(DAB, 2)) < 0.01)
            {
                WhichLine = "AB";
                return true;
            }
            return false;
        }
        private double DistanceDecimal(double x1, double y1, double x2, double y2)
        {
            return Math.Sqrt(Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2));
        }
        private double DistanceRoot(double x1, double y1, double x2, double y2)
        {
            return (Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2));
        }
        private void setWorkLabels(double x1, double y1, double x2, double y2)
        {
            setWorkVisibilities();
            workLabel1.Text = "Sqrt((" + x1 + "-" + x2 + ")^2 + (" + y1 + "-" + y2 + ")^2)";
            workLabel2.Text = "Sqrt((" + (x1 - x2) + ")^2 + (" + (y1 - y2) + ")^2)";
            workLabel3.Text = "Sqrt(" + Math.Pow(x1 - x2, 2) + " + " + Math.Pow(y1 - y2, 2) + ")";
            workLabel4.Text = "Sqrt(" + (Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2)) + ")";
            workLabel5.Text = Math.Sqrt((Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2))).ToString();
            workLabel6.Text = "";
        }
        private void setWorkLabelsMid(double x1, double y1, double x2, double y2)
        {
            setWorkVisibilities();
            workLabel1.Text = "(" + x1 + " + " + x2 + ")/2";
            workLabel2.Text = "(" + (x1 + x2) + ")/2";
            workLabel3.Text = "Mid X = " + ((x1 + x2) / 2);
            workLabel4.Text = "(" + y1 + " + " + y2 + ")/2";
            workLabel5.Text = "(" + (y1 + y2) + ")/2";
            workLabel6.Text = "Mid Y = " + ((y1 + y2) / 2);
        }
        private void setWorkLabelsSlope(double x1, double y1, double x2, double y2)
        {
            setWorkVisibilities();
            workLabel1.Text = "(" + y2 + "-" + y1 + ")/(" + x2 + "-" + x1 + ")";
            workLabel2.Text = (y2 - y1) + "/" + (x2 - x1);
            workLabel3.Text = ((y2 - y1) / (x2 - x1)).ToString();
            workLabel4.Text = "";
            workLabel5.Text = "";
            workLabel6.Text = "";
        }
        private void setWorkLabelsRTArea()
        {
            setWorkVisibilities();
            if (WhichLine.Equals("AB"))
            {
                workLabel1.Text = "AB > AC and BC, AB is hypotenuse";
                workLabel2.Text = "Area is 1/2 * base * height";
                workLabel3.Text = "area = .5 * " + DAC + " * " + DBC;
                workLabel4.Text = "area = .5 * " + (DAC * DBC);
                workLabel5.Text = "area = " + (.5 * DAC * DBC);
                workLabel6.Text = "";
            }
            if (WhichLine.Equals("AC"))
            {
                workLabel1.Text = "AC > AB and BC, AC is hypotenuse";
                workLabel2.Text = "Area is 1/2 * base * height";
                workLabel3.Text = "area = .5 * " + DAB + " * " + DBC;
                workLabel4.Text = "area = .5 * " + (DAB * DBC);
                workLabel5.Text = "area = " + (.5 * DAB * DBC);
                workLabel6.Text = "";
            }
            if (WhichLine.Equals("BC"))
            {
                workLabel1.Text = "BC > AC and AB, BC is hypotenuse";
                workLabel2.Text = "Area is 1/2 * base * height";
                workLabel3.Text = "area = .5 * " + DAC + " * " + DAB;
                workLabel4.Text = "area = .5 * " + (DAC * DAB);
                workLabel5.Text = "area = " + (.5 * DAC * DAB);
                workLabel6.Text = "";
            }
        }
        public void setWorkLabelsRTPolygon()
        {
            setWorkVisibilities();
            if (WhichLine.Equals("AB"))
            {
                workLabel1.Text = "AB = " + DAB;
                workLabel2.Text = "AC = " + DAC;
                workLabel3.Text = "BC = " + DBC;
                workLabel4.Text = "AB^2 = " + Math.Pow(DAB, 2) + ", AC^2 = " + Math.Pow(DAC, 2);
                workLabel5.Text = "BC^2 = " + Math.Pow(DBC, 2) + ", " + Math.Pow(DAC, 2) + " + " + Math.Pow(DBC, 2) + " = " + Math.Pow(DAB, 2);
                workLabel6.Text = "Triangle is right.";
            }
            if (WhichLine.Equals("AC"))
            {
                workLabel1.Text = "AB = " + DAB;
                workLabel2.Text = "AC = " + DAC;
                workLabel3.Text = "BC = " + DBC;
                workLabel4.Text = "AB^2 = " + Math.Pow(DAB, 2) + ", AC^2 = " + Math.Pow(DAC, 2);
                workLabel5.Text = "BC^2 = " + Math.Pow(DBC, 2) + ", " + Math.Pow(DAB, 2) + " + " + Math.Pow(DBC, 2) + " = " + Math.Pow(DAC, 2);
                workLabel6.Text = "Triangle is right.";
            }
            if (WhichLine.Equals("BC"))
            {
                workLabel1.Text = "AB = " + DAB;
                workLabel2.Text = "AC = " + DAC;
                workLabel3.Text = "BC = " + DBC;
                workLabel4.Text = "AB^2 = " + Math.Pow(DAB, 2) + ", AC^2 = " + Math.Pow(DAC, 2);
                workLabel5.Text = "BC^2 = " + Math.Pow(DBC, 2) + ", " + Math.Pow(DAC, 2) + " + " + Math.Pow(DAB, 2) + " = " + Math.Pow(DBC, 2);
                workLabel6.Text = "Triangle is right.";
            }
        }
        private void distanceLabel1_Click(object sender, EventArgs e)
        {
            setWorkLabels(x1, y1, x2, y2);
        }

        private void distanceLabel2_Click(object sender, EventArgs e)
        {
            setWorkLabels(x1, y1, x3, y3);
        }

        private void distanceLabel3_Click(object sender, EventArgs e)
        {
            setWorkLabels(x1, y1, x4, y4);
        }

        private void distanceLabel5_Click(object sender, EventArgs e)
        {
            setWorkLabels(x2, y2, x4, y4);
        }

        private void distanceLabel6_Click(object sender, EventArgs e)
        {
            setWorkLabels(x3, y3, x4, y4);
        }

        private void midLabel1_Click(object sender, EventArgs e)
        {
            setWorkLabelsMid(x1, y1, x2, y2);
        }

        private void midLabel2_Click(object sender, EventArgs e)
        {
            setWorkLabelsMid(x1, y1, x3, y3);
        }

        private void midLabel3_Click(object sender, EventArgs e)
        {
            setWorkLabelsMid(x1, y1, x4, y4);
        }

        private void midLabel4_Click(object sender, EventArgs e)
        {
            setWorkLabelsMid(x2, y2, x3, y3);
        }

        private void midLabel5_Click(object sender, EventArgs e)
        {
            setWorkLabelsMid(x2, y2, x4, y4);
        }

        private void midLabel6_Click(object sender, EventArgs e)
        {
            setWorkLabelsMid(x3, y3, x4, y4);
        }

        private void tabPage1_Click(object sender, EventArgs e)
        {

        }

        private void slopeLabel1_Click(object sender, EventArgs e)
        {
            setWorkLabelsSlope(x1, y1, x2, y2);
        }

        private void slopeLabel2_Click(object sender, EventArgs e)
        {
            setWorkLabelsSlope(x1, y1, x3, y3);
        }

        private void slopeLabel3_Click(object sender, EventArgs e)
        {
            setWorkLabelsSlope(x2, y2, x3, y3);
        }

        private void slopeLabel4_Click(object sender, EventArgs e)
        {
            setWorkLabelsSlope(x1, y1, x4, y4);
        }

        private void slopeLabel5_Click(object sender, EventArgs e)
        {
            setWorkLabelsSlope(x2, y2, x4, y4);
        }

        private void slopeLabel6_Click(object sender, EventArgs e)
        {
            setWorkLabelsSlope(x3, y3, x4, y4);
        }

        private void areaLabel1_Click(object sender, EventArgs e)
        {
            if (xBox4.Text.Length == 0 && yBox4.Text.Length == 0)
            {
                if (TriangleHasRightAngle())
                {
                    setWorkLabelsRTArea();
                }
            }
        }

        private void polygonType1_Click(object sender, EventArgs e)
        {
            if (xBox4.Text.Length == 0 && yBox4.Text.Length == 0)
            {
                if (TriangleHasRightAngle())
                {
                    setWorkLabelsRTPolygon();
                }
            }
        }

        private void label9_Click(object sender, EventArgs e)
        {

        }
        Fraction myFrac1;
        Fraction myFrac2;
        private void button1_Click(object sender, EventArgs e)
        {
            string[] fuckingfrac = textBox1.Text.Split(new char[] { '/' });
            string[] secondfrac = textBox2.Text.Split(new char[] { '/' });
            myFrac1 = new Fraction(int.Parse(fuckingfrac[0]), int.Parse(fuckingfrac[1]));
            myFrac2 = new Fraction(int.Parse(secondfrac[0]), int.Parse(secondfrac[1]));
            label9.Text = "" + myFrac1.Add(myFrac2).ToString();
            label10.Text = "" + myFrac1.Add(2, 3).ToString();
            label11.Text = "" + myFrac1.Add(5).ToString();
            label12.Text = "" + myFrac1.Subtract(myFrac2).ToString();
            label15.Text = "" + myFrac1.Subtract(2, 3).ToString();
            label16.Text = "" + myFrac1.Subtract(5).ToString();
            label17.Text = "" + myFrac1.Multiply(myFrac2).ToString();
            label18.Text = myFrac1.Multiply(2, 3).ToString();
            label19.Text = myFrac1.Multiply(5).ToString();
            label20.Text = myFrac1.Divide(myFrac2).ToString();
            label21.Text = myFrac1.Divide(2, 3).ToString();
            label22.Text = myFrac1.Divide(3).ToString();

        }
        
    }
}