private void newToolStripMenuItem_Click(object sender, EventArgs e) { buildToolStripMenuItem.Visible = true; openFileDialog1.FileName = ""; NewFile mdiChild = new NewFile(); mdiChild.MdiParent = this; mdiChild.Show(); }
private void openFileDialog1_FileOk(object sender, CancelEventArgs e) { buildToolStripMenuItem.Visible = true; FileText = openFileDialog1.FileName; Form activeChild = this.ActiveMdiChild; if (activeChild != null) { SplitContainer sp = (SplitContainer)activeChild.ActiveControl; RichTextBox editBox = (RichTextBox)sp.Panel2.Controls[0]; RichTextBox editBox1 = (RichTextBox)sp.Panel1.Controls[0]; if (editBox.Text == "") { if (editBox != null) { Encoding en = Encoding.GetEncoding(1251); StreamReader sr = new StreamReader(openFileDialog1.FileName, en); while (!sr.EndOfStream) { editBox.Text = editBox.Text + sr.ReadLine() + "\n"; if (sr.EndOfStream) { editBox.Text = editBox.Text.Remove(editBox.Text.Length - 1); break; } editBox1.Text = editBox1.Text + (++NewFile.num).ToString() + "\n"; } NewFile.IsReaded = true; sr.Close(); activeChild.Text = openFileDialog1.FileName; } } else { NewFile mdiChild = new NewFile(); mdiChild.MdiParent = this; mdiChild.Show(); } } else { NewFile mdiChild = new NewFile(); mdiChild.MdiParent = this; mdiChild.Show(); } }
private void MainForm_Load(object sender, EventArgs e) { try { StreamReader sr = new StreamReader(FileText); sr.Close(); } catch { FileText = ""; } NewFile mdiChild = new NewFile(); mdiChild.MdiParent = this; mdiChild.Show(); buildToolStripMenuItem.Visible = true; }