private void openToolStripMenuItem_Click(object sender, EventArgs e) { frmChild frm = new frmChild(); frm.MdiParent = this; frm.Show(); saveToolStripMenuItem.Enabled = true; saveSToolStripMenuItem.Enabled = true; if (ofd1.ShowDialog() == DialogResult.OK) { string text = System.IO.File.ReadAllText(ofd1.FileName); frmChild frmActive = (frmChild)this.ActiveMdiChild; if (frmActive != null) { frmActive.richTextBox1.Text = text; } frm.Text = ofd1.FileName; /*StreamReader objDoc = new StreamReader(ofd1.FileName); * frmChild frm = new frmChild(); * frm.MdiParent = this; * frm.Show(); * frm.Text = ofd1.FileName; * frm.richTextBox1.Text = objDoc.ReadToEnd();*/ } ; }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { frmChild frm = new frmChild(); frm.MdiParent = this; frm.Show(); i = i + 1; frm.Text = "Notepad" + i; }
private void selectAllToolStripMenuItem_Click(object sender, EventArgs e) { frmChild frmActive = (frmChild)this.ActiveMdiChild; if (frmActive != null) { frmActive.richTextBox1.Select(0, frmActive.richTextBox1.TextLength); } }
private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { frmChild frmActive = (frmChild)this.ActiveMdiChild; if (Clipboard.ContainsText(TextDataFormat.UnicodeText)) { frmActive.richTextBox1.Paste(); } }
private void undoToolStripMenuItem_Click(object sender, EventArgs e) { frmChild frmActive = (frmChild)this.ActiveMdiChild; if (frmActive != null) { frmActive.richTextBox1.Undo(); } }
private void timeDateToolStripMenuItem_Click(object sender, EventArgs e) { frmChild frmActive = (frmChild)this.ActiveMdiChild; if (frmActive != null) { DateTime localDate = DateTime.Now; frmActive.richTextBox1.Text += localDate.ToString(); } }
private void printToolStripMenuItem_Click(object sender, EventArgs e) { frmChild frmActive = (frmChild)this.ActiveMdiChild; if (frmActive != null) { if (printDialog1.ShowDialog() == DialogResult.OK) { } } }
private void fontToolStripMenuItem_Click(object sender, EventArgs e) { frmChild frmActive = (frmChild)this.ActiveMdiChild; if (frmActive != null) { if (fontDialog1.ShowDialog() == DialogResult.OK) { frmActive.richTextBox1.Font = fontDialog1.Font; } } }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { frmChild frmActive = (frmChild)this.ActiveMdiChild; if (frmActive != null) { if (saveFileDialog1.ShowDialog() == DialogResult.OK) { frmActive.richTextBox1.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.UnicodePlainText); } } }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { frmChild frmActive = (frmChild)this.ActiveMdiChild; if (frmActive != null) { if (frmActive.richTextBox1.SelectedText != "") { frmActive.richTextBox1.SelectedText = ""; } } }
private void pageSetupToolStripMenuItem_Click(object sender, EventArgs e) { frmChild frmActive = (frmChild)this.ActiveMdiChild; if (frmActive != null) { if (pageSettupDialog.ShowDialog() == DialogResult.OK) { //frmActive.richTextBox1. } } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { if (ofd1.ShowDialog() == DialogResult.OK) { StreamReader objDoc = new StreamReader(ofd1.FileName); frmChild frm = new frmChild(); frm.MdiParent = this; frm.Show(); frm.Text = ofd1.FileName; frm.richTextBox1.Text = objDoc.ReadToEnd(); } ; }
private void saveSToolStripMenuItem_Click(object sender, EventArgs e) { frmChild frmActive = (frmChild)this.ActiveMdiChild; if (frmActive != null) { if (saveAsFileDialog.ShowDialog() == DialogResult.OK) { string text = frmActive.GetString(); System.IO.File.WriteAllText(saveAsFileDialog.FileName, text); //frmActive.richTextBox1.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.PlainText); } } }
private void gotoToolStripMenuItem_Click(object sender, EventArgs e) { frmChild frmActive = (frmChild)this.ActiveMdiChild; frmActive.creatFrmGoTo().Show(); }
public frmGoTo(frmChild frm) { frmCh = frm; InitializeComponent(); }