public Form1() { InitializeComponent(); FileName = null; DoubleBuffered = true; thickCount = 0; ballDoc = new BallDoc(this.Width); Timer = new Timer(); Timer.Enabled = true; Timer.Interval = 200; Timer.Tick += new EventHandler(this.Thick); Timer.Start(); this.Paint += new PaintEventHandler(this.Paint_Form); this.MouseClick += new MouseEventHandler(this.Mouse_Click); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { FileName = null; OpenFileDialog op = new OpenFileDialog(); if (op.ShowDialog() == DialogResult.OK) { FileName = op.FileName; } if (FileName != null) { System.Runtime.Serialization.IFormatter formatter = new System.Runtime.Serialization. Formatters.Binary.BinaryFormatter(); FileStream str = new FileStream(FileName, FileMode.Open); ballDoc = (BallDoc)formatter.Deserialize(str); str.Close(); } }