Exemple #1
0
        private void OpenFile()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Lines doc file (*.lns)|*.lns";
            openFileDialog.Title  = "Open Lines doc file";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                FileName = openFileDialog.FileName;
                try
                {
                    using (FileStream filestream = new FileStream(FileName, FileMode.Open))
                    {
                        IFormatter formatter = new BinaryFormatter();
                        linesDoc = (LinesDocument)formatter.Deserialize(filestream);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not read file: " + FileName, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    FileName = null;
                    return;
                }
                Invalidate(true);
            }
        }
Exemple #2
0
 public Form1()
 {
     InitializeComponent();
     linesDoc       = new LinesDocument(Width, Height);
     DoubleBuffered = true;
     FileName       = "Untitled";
     normalToolStripMenuItem.Checked = true;
 }
Exemple #3
0
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     linesDoc = new LinesDocument(Width, Height);
     Invalidate(true);
 }