예제 #1
0
        public Form1()
        {
            CheckForIllegalCrossThreadCalls = false;
            p = new Postavke();
            p.Show();
            p.Hide();
            graf = new prikaz_tocki(p);
            th   = new Thread(graf.poc);
            //var obj = new WindowsFormsApplication1.SimpleWindow();

            //new Thread(obj.poc).Start();
            InitializeComponent();
            number_of_controls_without_funcs = this.Controls.Count;
            dbpath = Application.StartupPath + global::Interpolator.Properties.Resources.NameOfDbString;
            if (!File.Exists(dbpath))
            {
                ADOX.Catalog cat = new ADOX.Catalog();
                try
                {
                    cat.Create("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + dbpath);
                }
                catch (Exception e)
                {
                    if (Debug)
                    {
                        MessageBox.Show(e.ToString());
                    }
                }

                cat = null;
            }
            else
            {
                ADOX.Catalog cat = new ADOX.Catalog();
                System.IO.File.Delete(dbpath);
                cat.Create("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + dbpath);
            }
            conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + dbpath);

            //adapter.Fill(medataset);
            try
            {
                using (OleDbCommand cmd = new OleDbCommand(global::Interpolator.Properties.Resources.PropertiesCreateString, conn))
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                    conn.Close();
                }
            }
            catch (Exception ee) { if (Debug)
                                   {
                                       MessageBox.Show("Error: " + ee.ToString());
                                   }
            }
            medataset = new DataSet();
            OleDbCommand cmd1 = new OleDbCommand(selekt, conn);

            adapter = new OleDbDataAdapter(cmd1);
            adapter.Fill(medataset);

            updatezy();
        }
예제 #2
0
        public string string_func(tocke[] temp, int mode, Postavke p)
        {
            if (temp == null)
            {
                return("f(x)=NULL");
            }
            Thread.CurrentThread.CurrentCulture = new CultureInfo("hr-HR");
            StringBuilder temp_string = new StringBuilder();

            temp_string.Append("f(X)=");
            string rje = "";

            #region sine
            if (mode == 1)
            {
                for (int i = 0; i < temp.Length; i++)
                {
                    double broj = Math.Round(temp[i].y, p.BrojDecimala);
                    if (broj != 0)
                    {
                        if (broj > 0 && i > 0)
                        {
                            temp_string.Append("+");
                        }
                        temp_string.Append(broj);
                        if (i > 0)
                        {
                            temp_string.Append("sin(");
                        }
                        if (dif == Double.PositiveInfinity)
                        {
                            dif = 0;
                        }
                        if (dif * i != 1 && dif * i != 0)
                        {
                            temp_string.Append(Math.Round(dif * i, p.BrojDecimala));
                        }
                        if (i > 0)
                        {
                            temp_string.Append("X) ");
                        }
                    }
                }
                rje = temp_string.ToString();
            }
            #endregion
            #region poly
            string expontent = "⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾";
            if (mode == 0)
            {
                for (int i = 0; i < temp.Length; i++)
                {
                    double broj = Math.Round(temp[i].y, p.BrojDecimala);
                    if (broj != 0)
                    {
                        if (broj > 0 && i > 0)
                        {
                            temp_string.Append("+");
                        }
                        temp_string.Append(broj);
                        if (temp[i].x > 0)
                        {
                            temp_string.Append("X");
                            if (temp[i].x > 1)
                            {
                                string tmp = temp[i].x.ToString();
                                for (int ii = 0; ii < tmp.Length; ii++)
                                {
                                    int index = Convert.ToInt32(tmp.Substring(ii, 1));
                                    temp_string.Append(expontent[index]);
                                }
                            }
                        }
                    }
                }
                rje = temp_string.ToString();
            }
            #endregion
            return(rje);
        }
예제 #3
0
 public prikaz_tocki(Postavke p) : base(400, 300, new OpenTK.Graphics.GraphicsMode(32, 24, 0, 8))
 {
     MouseMove      += Prikaz_tocki_MouseMove;
     KeyDown        += Keyboard_KeyDown;
     PostavkeGrafike = p;
 }