コード例 #1
0
        private void newFile_Click(object sender, EventArgs e)
        {
            DocumentForm mdiChild = new DocumentForm();

            mdiChild.MdiParent = this;
            mdiChild.Show();
        }
コード例 #2
0
 private void fontsComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.ActiveMdiChild != null)
     {
         DocumentForm active = (DocumentForm)this.ActiveMdiChild;
         active.changeFont(new FontFamily((string)this.fontsComboBox.SelectedItem));
     }
 }
コード例 #3
0
 private void changeColorButton_Click(object sender, EventArgs e)
 {
     if (this.ActiveMdiChild != null)
     {
         DocumentForm active = (DocumentForm)this.ActiveMdiChild;
         active.changeColor();
     }
 }
コード例 #4
0
 private void saveFileButton_Click(object sender, EventArgs e)
 {
     if (this.ActiveMdiChild != null)
     {
         DocumentForm active = (DocumentForm)this.ActiveMdiChild;
         active.saveFile();
     }
 }
コード例 #5
0
        private void openFileButton_Click(object sender, EventArgs e)
        {
            var openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = "C:\\Users\\admin\\Documents";
            openFileDialog.Filter           = "Rich Text File|*.rtf";
            openFileDialog.DefaultExt       = "*.rtf";
            openFileDialog.RestoreDirectory = true;

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    DocumentForm mdiChild = new DocumentForm(openFileDialog.FileName);
                    mdiChild.MdiParent = this;
                    mdiChild.Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
                }
            }
        }