Пример #1
0
        private static double CalcProp(double?A, double?B, double?C, double?D)
        {
            ErrorMessage = "";
            double X = 0;

            if (A == null)
            {
                if (D == 0)
                {
                    ErrorMessage = "Divide by zero!";
                    DrawFormula.SetStrings(B.ToString(), C.ToString(), D.ToString(), "0");
                    return(0);
                }
                X = (double)((B * C) / D);
                DrawFormula.SetStrings(B.ToString(), C.ToString(), D.ToString(), X.ToString());
                return(X);
            }

            if (B == null)
            {
                if (C == 0)
                {
                    ErrorMessage = "Divide by zero!";
                    DrawFormula.SetStrings(A.ToString(), D.ToString(), C.ToString(), "0");
                    return(0);
                }
                X = (double)((A * D) / C);
                DrawFormula.SetStrings(A.ToString(), D.ToString(), C.ToString(), X.ToString());
                return(X);
            }

            if (C == null)
            {
                if (B == 0)
                {
                    ErrorMessage = "Divide by zero!";
                    DrawFormula.SetStrings(A.ToString(), D.ToString(), B.ToString(), "0");
                    return(0);
                }
                X = (double)((A * D) / B);
                DrawFormula.SetStrings(A.ToString(), D.ToString(), B.ToString(), X.ToString());
                return(X);
            }

            if (D == null)
            {
                if (A == 0)
                {
                    ErrorMessage = "Divide by zero!";
                    DrawFormula.SetStrings(B.ToString(), C.ToString(), A.ToString(), "0");
                    return(0);
                }
                X = (double)((B * C) / A);
                DrawFormula.SetStrings(B.ToString(), C.ToString(), A.ToString(), X.ToString());
                return(X);
            }

            return(0);
        }
Пример #2
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            chkXD.Checked      = true;
            DrawFormula.pbDraw = pbDrawFormula;
            DrawFormula.InitGraph();

            HideScheme();
        }