private void toolStripMenuItemOpen_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "Triangle or Circle file (*.crcl;*.tri)|*.crcl;*.tri|Circle file (*.crcl)|*.crcl|Triangle file (*.tri)|*.tri"; openFileDialog1.Title = "Open a Circle or Triangle File"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { if (System.IO.Path.GetExtension(openFileDialog1.FileName) == ".crcl") { FormCircleView childForm = new FormCircleView(this, openFileDialog1.FileName); if (childForm.FileName == null) { childForm.Dispose(); } else { childForm.Show(); } } else if (System.IO.Path.GetExtension(openFileDialog1.FileName) == ".tri") { FormTriangleView childForm = new FormTriangleView(this, openFileDialog1.FileName); if (childForm.FileName == null) { childForm.Dispose(); } else { childForm.Show(); } } } }
private void newCoinToolStripMenuItem_Click(object sender, EventArgs e) { // Declare the child form as a new one. FormCircleView childForm = new FormCircleView(); // Set the main form as a parent form. childForm.MdiParent = this; // Show the child form. childForm.Show(); }