public void Open() { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Circle doc file (*.cir) | *.cir"; openFileDialog.Title = "OpenFile"; if (openFileDialog.ShowDialog() == DialogResult.OK) { FileName = openFileDialog.FileName; try { using (FileStream filestream = new FileStream(FileName, FileMode.Open)) { IFormatter formatter = new BinaryFormatter(); doc = (ElipsiDoc)formatter.Deserialize(filestream); } } catch (Exception e) { MessageBox.Show("Could not read file: " + FileName); FileName = null; return; } Invalidate(true); } }
public Form1() { InitializeComponent(); doc = new ElipsiDoc(); this.DoubleBuffered = true; start = Point.Empty; end = Point.Empty; timer = new Timer(); timer.Interval = 200; timer.Tick += new EventHandler(timer_tick); timer.Start(); }