コード例 #1
0
ファイル: MDIForm.cs プロジェクト: Minetactics/EditeurExe
        private void nouveauToolStripMenuItem_Click(object sender, EventArgs e)
        {
            EditeurForm monEditeurForm = new EditeurForm();

            monEditeurForm.Text      = "Nouveau document créé le " + DateTime.Now;
            monEditeurForm.MdiParent = this;
            monEditeurForm.Show();
        }
コード例 #2
0
ファイル: MDIForm.cs プロジェクト: Minetactics/EditeurExe
        private void ouvrirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog monOpenFileDialog = new OpenFileDialog();

            monOpenFileDialog.Filter      = "Fichier (*.rtf)|*.rtf |Tous les fichiers|*.*";
            monOpenFileDialog.FilterIndex = 1;
            DialogResult result = monOpenFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                EditeurForm monEditeurForm = new EditeurForm();
                String      clearname      = monOpenFileDialog.FileName;
                while (clearname.Contains("/") && clearname.Contains("\\"))
                {
                    clearname.Remove(0, clearname.IndexOf("/"));
                    clearname.Remove(0, clearname.IndexOf("\\"));
                }
                monEditeurForm.Text      = clearname;
                monEditeurForm.MdiParent = this;
                monEditeurForm.Show();
                RichTextBox rtb = (RichTextBox)monEditeurForm.ActiveControl;
                rtb.LoadFile(monOpenFileDialog.FileName);
            }
        }