コード例 #1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MdiChildForm child = new MdiChildForm();

            child.MdiParent = this;

            openFileDialog1.InitialDirectory = "C:";
            openFileDialog1.Title            = "Open File";
            openFileDialog1.FileName         = "";
            openFileDialog1.Filter           = "All files|*.*|Text Files|*.txt|JPEG Images|*.jpg";

            openFileDialog1.ShowDialog();

            try
            {
                System.IO.StreamReader sReader = new System.IO.StreamReader(openFileDialog1.FileName);
                child.Show();
                child.ShowTextInRichTextBox(sReader);
                child.Text = openFileDialog1.FileName;
            }
            catch (ArgumentException)
            {
                child.Show();
                child.ShowTextInRichTextBox(null);
            }
        }
コード例 #2
0
        private void createToolStripMenuItem_Click(object sender, EventArgs e)
        {
            documentCounter++;
            MdiChildForm child = new MdiChildForm();

            child.MdiParent = this;
            child.Show();
            child.Text = "Document " + documentCounter;
        }