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

            openFileDialog.Filter = "Cicles 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 = (BallsDoc)formatter.Deserialize(filestream);
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show("Could not read file: " + FileName);
                    FileName = null;
                    return;
                }
                Invalidate(true);
            }
        }
示例#2
0
文件: Form1.cs 项目: AtanasK/VP
 private void openFile()
 {
     OpenFileDialog openFileDialog = new OpenFileDialog();
     openFileDialog.Filter = "Balls doc file (*.bll)|*.bll";
     openFileDialog.Title = "Open balls doc file";
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         FileName = openFileDialog.FileName;
         try
         {
             using (FileStream fileStream = new FileStream(FileName, FileMode.Open))
             {
                 IFormatter formater = new BinaryFormatter();
                 doc = (BallsDoc)formater.Deserialize(fileStream);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Could not read file: " + FileName);
             FileName = null;
             return;
         }
         Invalidate(true);
     }
 }
示例#3
0
文件: Form1.cs 项目: AtanasK/VP
 public Form1()
 {
     InitializeComponent();
     DoubleBuffered = true;
     doc = new BallsDoc(this.Width, this.Height);
     timer = new Timer();
     timer.Interval = 50;
     timer.Tick += new EventHandler(timer_Tick);
 }
示例#4
0
 public Form1()
 {
     InitializeComponent();
     DoubleBuffered = true;
     doc            = new BallsDoc(this.Width, this.Height);
     timer          = new Timer();
     timer.Interval = 50;
     timer.Tick    += new EventHandler(timer_Tick);
 }
示例#5
0
 public Form1()
 {
     InitializeComponent();
     doc = new BallsDoc();
     this.DoubleBuffered = true;
     timer          = new Timer();
     timer.Interval = 50;
     timer.Tick    += new EventHandler(timer_Tick);
     timer.Start();
 }
示例#6
0
文件: Form1.cs 项目: AtanasK/VP
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     doc = new BallsDoc(Width, Height);
     Invalidate(true);
 }
示例#7
0
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     doc = new BallsDoc(Width, Height);
     Invalidate(true);
 }
示例#8
0
 public void newFile()
 {
     clickedBall = null;
     random      = new Random();
     balls       = new BallsDoc();
 }