private void OpenFile(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); openFileDialog.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*"; if (openFileDialog.ShowDialog() == DialogResult.OK) { FrmTxt frm = new FrmTxt(); frm.Text = openFileDialog.FileName; frm.richTextBoxPrintCtrl1.Clear(); frm.richTextBoxPrintCtrl1.LoadFile(openFileDialog.FileName, RichTextBoxStreamType.PlainText); frm.MdiParent = this; frm.Show(); } }
private void 文档管理ToolStripMenuItem_Click(object sender, EventArgs e) { FrmTxt frm = new FrmTxt(); frm.Show(); }