private void OpenFile(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); //openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string directory = Directory.GetCurrentDirectory(); openFileDialog.InitialDirectory = directory; //openFileDialog.Filter = "JNS Files (*.jns)|*.jns|Text Files (*.txt)|*.txt|All Files (*.*)|*.*"; openFileDialog.Filter = "JNS Files (*.jns)|*.jns"; //LevelDesigner levelDesigner = this.ActiveMdiChild as LevelDesigner; if (openFileDialog.ShowDialog(this) == DialogResult.OK) { string path = openFileDialog.FileName; string filename = openFileDialog.SafeFileName; Form childForm = new LevelDesigner(); childForm.MdiParent = this; childForm.Text = filename; childForm.Show(); // load file into leveldesigner LevelDesigner levelDesigner = this.ActiveMdiChild as LevelDesigner; levelDesigner.LoadFromFile(path); } }
private void newLevel_Click(object sender, EventArgs e) { Form childForm = new LevelDesigner(); childForm.MdiParent = this; childForm.Text = "Level " + childFormNumber++; childForm.Show(); }
private void ShowNewForm(object sender, EventArgs e) { //Form childForm = new Form(); //childForm.MdiParent = this; //childForm.Text = "Window " + childFormNumber++; //childForm.Show(); Form childForm = new LevelDesigner(); childForm.MdiParent = this; childForm.Text = "Unnamed Level"; childForm.Show(); }