示例#1
0
文件: Form1.cs 项目: AtanasK/VP
 public Form1()
 {
     InitializeComponent();
     BallDoc = new BallDoc();
     currentColor = Color.Red;
     DoubleBuffered = true;
     timer1.Start();
 }
示例#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();
                 BallDoc = (BallDoc)formater.Deserialize(fileStream);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Could not read file: " + FileName);
             FileName = null;
             return;
         }
         Invalidate(true);
     }
 }
示例#3
0
文件: Form1.cs 项目: AtanasK/VP
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     BallDoc = new BallDoc();
     Invalidate(true);
 }