Exemple #1
0
        private void buttonOpenBezierSVG_Click(object sender, EventArgs e)
        {
            StreamReader reader = null;

            try
            {
                OpenFileDialog dialog = new OpenFileDialog();
                dialog.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
                DialogResult dlgResult = dialog.ShowDialog();
                if (dlgResult != DialogResult.OK)
                {
                    return;
                }

                reader = new StreamReader(dialog.FileName);
                string pointsFileContent = reader.ReadLine();

                _points = Bezier.AbsoluteBezierPoints(pointsFileContent, true);

                textBoxBezierOriginal.Clear();

                for (int i = 0; i < _points.Count; i++)
                {
                    textBoxBezierOriginal.AppendText(string.Format("{0}, {1}\r\n", _points[i].X, _points[i].Y));
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }