private void openFile()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Polygons balls 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();
                        ballsDoc = (BallsDoc)formater.Deserialize(fileStream);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not read file: " + FileName);
                    FileName = null;
                    return;
                }
                Invalidate(true);
            }
        }
 public Form1()
 {
     InitializeComponent();
     ballsDoc            = new BallsDoc();
     currentColor        = Color.Red;
     this.DoubleBuffered = true;
     timer          = new Timer();
     timer.Interval = 50;
     timer.Tick    += new EventHandler(timer_Tick);
     timer.Start();
     leftX  = 20;
     topY   = 60;
     width  = this.Width - (3 * leftX);
     height = this.Height - (int)(2.5 * topY);
 }
Пример #3
0
 public Form1()
 {
     InitializeComponent();
     ballsDoc = new BallsDoc();
     currentColor = Color.Red;
     this.DoubleBuffered = true;
     timer = new Timer();
     timer.Interval = 50;
     timer.Tick += new EventHandler(timer_Tick);
     timer.Start();
     leftX = 20;
     topY = 60;
     width = this.Width - (3 * leftX);
     height = this.Height - (int)(2.5 * topY);
 }
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ballsDoc = new BallsDoc();
     Invalidate(true);
 }
Пример #5
0
 private void openFile()
 {
     OpenFileDialog openFileDialog = new OpenFileDialog();
     openFileDialog.Filter = "Polygons balls 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();
                 ballsDoc = (BallsDoc)formater.Deserialize(fileStream);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Could not read file: " + FileName);
             FileName = null;
             return;
         }
         Invalidate(true);
     }
 }
Пример #6
0
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ballsDoc = new BallsDoc();
     Invalidate(true);
 }