public FormParent(string[] args) { InitializeComponent(); if (args.Length==3) { String filename = args[1]; MessageBox.Show(filename); string text = System.IO.File.ReadAllText(filename); FormChild child = new FormChild(filename, text, this); //filename is the path toggleToolsAvailability("on"); child.MdiParent = this; child.Text = filename; child.Show(); //show the child } toggleToolsAvailability("off"); if(defaultEmailMethod == null) { useDefaultToolStripMenuItem.Enabled = false; } }
/// <summary> /// opens an exisiting text file in a mdi child form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void openToolStripMenuItem_Click(object sender, EventArgs e) { var result = openFileDialogParent.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { String filename = openFileDialogParent.FileName; MessageBox.Show(filename); string text = System.IO.File.ReadAllText(filename); FormChild child = new FormChild(filename, text, this); //filename is the path toggleToolsAvailability("on"); child.MdiParent = this; child.Text = filename; child.Show(); //show the child } }
/// <summary> /// opens a new mdi child /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void newToolStripMenuItem_Click(object sender, EventArgs e) { FormChild child = new FormChild(this); //make a FormChild toggleToolsAvailability("on"); child.MdiParent = this; child.Show(); //show the child }