Beispiel #1
0
 private void btnDrawDerNew_Click(object sender, EventArgs e)
 {
     try
     {
         string v = tbxFormula.Text;
         if (rbtnPrefix.Checked)
         {
             if (v != "")
             {
                 tabControl1.SelectedIndex = 0;
                 treeDerN = treeDerN.Create(v);
                 treeDerN.DrawBinaryTreeDerivative();
                 this.draw.DrawDerNe(treeDerN);
             }
             else
             {
                 MessageBox.Show("Please, write a valid formula!");
             }
         }
         else
         {
             MessageBox.Show("Please, select the radio button!");
         }
     }
     catch (MyException m)
     {
         MessageBox.Show(m.Message);
     }
 }
Beispiel #2
0
        private void btnBinaryDerivative_Click(object sender, EventArgs e)
        {
            string v = tbxFormula.Text;

            if (rbtnPrefix.Checked)
            {
                if (v != "")
                {
                    treeDerN = treeDerN.Create(v);
                    treeDerN.DrawBinaryTreeDerivative();
                    dot.StartInfo.FileName  = "dot.exe";
                    dot.StartInfo.Arguments = "dot -Tpng -oabc.png abc.dot";
                    dot.Start();
                    dot.WaitForExit();
                    pictureBox1.ImageLocation = "abc.png";
                    tabControl1.SelectedIndex = 1;
                }
                else
                {
                    MessageBox.Show("Please, write a valid formula!");
                }
            }
            else
            {
                MessageBox.Show("Please, select the radio button!");
            }
        }
Beispiel #3
0
 private void btnBinaryPolonomial_Click(object sender, EventArgs e)
 {
     if (lbxPoints.Items.Count < 2)
     {
         MessageBox.Show("Please, add some points to get a polonomial!");
     }
     else
     {
         Polonomial polonomial = new Polonomial();
         points = new int[lbxPoints.Items.Count * 2];
         int index = 0;
         for (int i = 0; i < lbxPoints.Items.Count; i++)
         {
             string point = lbxPoints.Items[i].ToString();
             string s     = point.Substring(0, 1);
             while (s != ")")
             {
                 if (s == "(")
                 {
                     point = point.Substring(1);
                     s     = point.Substring(0, 1);
                 }
                 else if (s == ",")
                 {
                     point = point.Substring(1);
                     s     = point.Substring(0, 1);
                 }
                 else
                 {
                     string number = "";
                     while (s != "," && s != ")")
                     {
                         number = number + s;
                         point  = point.Substring(1);
                         s      = point.Substring(0, 1);
                     }
                     points[index] = Convert.ToInt32(number);
                     index++;
                 }
             }
         }
         for (int i = 0; i < points.Length; i += 2)
         {
             polonomial.MakesRows(lbxPoints.Items.Count, points[i], points[i + 1]);
         }
         treePolonomial = polonomial.MakeBinaryTreePolonomial();
         treePolonomial.DrawBinaryTreeDerivative();
         dot.StartInfo.FileName  = "dot.exe";
         dot.StartInfo.Arguments = "dot -Tpng -oabc.png abc.dot";
         dot.Start();
         dot.WaitForExit();
         pictureBox1.ImageLocation = "abc.png";
         tabControl1.SelectedIndex = 1;
     }
 }