Esempio n. 1
0
        // when selecting a formula from the tree view
        private void funcList_AfterSelect(object sender, TreeViewEventArgs e)
        {
            MathFormulary    math             = new MathFormulary();
            PhysicsFormulary physicsFormulary = new PhysicsFormulary();

            Print("checks " + e.Node.Text);
            foreach (BaseFormula formula in math.formulas)
            {
                if (formula.Name == e.Node.Text)
                {
                    Print("found");
                    BaseFormulary.TextboxPlacement(formula.VarCount, this);
                    break;
                }
            }

            /*
             * if (e.Node.Name == "matematik")
             * {
             *  Print("Matematik");
             *  ShowMath();
             * }
             * else if (funcList.Parent.Name.Equals(physicsFormulary.treeNode.Name))
             * {
             *  ShowPhysics();
             * }
             */
        }
Esempio n. 2
0
        public void ShowMath()
        {
            SphereCircumference sphereCircumference = new SphereCircumference();
            //sphereCircumference.Shared();
            MathFormulary mathFormulary = new MathFormulary();

            // loop through all formulas in the MathFormulary
            foreach (BaseFormula formula in mathFormulary.formulas)
            {
                // if the current formula is the one selected
                if (formula.Name == funcList.SelectedNode.Text)
                {
                    // set the current formula as the currentFormula or the selected formula
                    currentFormula = formula;
                    sphereCircumference.Shared();


                    for (int i = 0; i < formula.VarCount; i++)
                    {
                        textBoxes.Add(new TextBox());
                        int usableSpace = 656 / (formula.VarCount + 1);

                        TextBox text = new TextBox();
                        //text.Location = new Point(100, 100);
                        Formelsamling form1 = new Formelsamling();
                        form1.Controls.Add(text);
                        text.Visible = true;

                        textBoxes[textBoxes.Count - 1].Location = new Point(usableSpace * (i + 1), 200);
                    }

                    foreach (TextBox txtBox in textBoxes)
                    {
                        Controls.Add(txtBox);
                    }
                }

                // get out of loop
                break;
            }
        }