示例#1
0
        public void Open()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Baloons doc file (*.bal) | *.bal";
            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 = (BaloonsDoc)formatter.Deserialize(filestream);
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show("Could not read file: " + FileName);
                    FileName = null;
                    return;
                }
                Invalidate(true);
            }
        }
示例#2
0
 public Form1()
 {
     InitializeComponent();
     doc = new BaloonsDoc();
     this.DoubleBuffered = true;
     timer          = new Timer();
     timer.Interval = 100;
     timer.Tick    += new EventHandler(timer_tick);
     timer.Start();
 }
示例#3
0
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     doc = new BaloonsDoc();
     x   = 25;
 }