private void newFile_Click(object sender, EventArgs e) { DocumentForm mdiChild = new DocumentForm(); mdiChild.MdiParent = this; mdiChild.Show(); }
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)); } }
private void changeColorButton_Click(object sender, EventArgs e) { if (this.ActiveMdiChild != null) { DocumentForm active = (DocumentForm)this.ActiveMdiChild; active.changeColor(); } }
private void saveFileButton_Click(object sender, EventArgs e) { if (this.ActiveMdiChild != null) { DocumentForm active = (DocumentForm)this.ActiveMdiChild; active.saveFile(); } }
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); } } }