private void Alignement_Click(object sender, EventArgs e) { try { TextEditorKMJ oTextEditor = this.ActiveMdiChild as TextEditorKMJ; if (sender == alignementGaucheToolStripButton) { alignementDroiteToolStripButton.Checked = false; alignementCentrerToolStripButton.Checked = false; oTextEditor.textEditorRichTextBox.SelectionAlignment = HorizontalAlignment.Left; } else if (sender == alignementDroiteToolStripButton) { alignementGaucheToolStripButton.Checked = false; alignementCentrerToolStripButton.Checked = false; oTextEditor.textEditorRichTextBox.SelectionAlignment = HorizontalAlignment.Right; } else { alignementGaucheToolStripButton.Checked = false; alignementDroiteToolStripButton.Checked = false; oTextEditor.textEditorRichTextBox.SelectionAlignment = HorizontalAlignment.Center; } } catch (Exception ex) { MessageBox.Show(g.tableauMessages[(int)ce.changerAlignementErreur] + Environment.NewLine + ex.ToString()); } }
private void Enregistrer_Click(object sender, EventArgs e) { try { if (this.MdiChildren.Count() >= 1 && this.ActiveMdiChild != null) { TextEditorKMJ textEditor; textEditor = this.ActiveMdiChild as TextEditorKMJ; if (sender == enregistrerToolStripButton || sender == enregistrerToolStripMenuItem) { textEditor.Enregitrer(); } else { textEditor.EnregitrerSous(); } infoToolStripStatusLabel.Text = this.ActiveMdiChild.Text; } else { TextEditorKMJ textEditor = this.ActiveMdiChild as TextEditorKMJ; textEditor.Close(); } } catch (Exception ex) { MessageBox.Show(g.tableauMessages[(int)ce.enregistrementErreur] + Environment.NewLine + ex.ToString()); } }
private void Fermer_Click(object sender, EventArgs e) { TextEditorKMJ textEditor = this.ActiveMdiChild as TextEditorKMJ; if (this.ActiveControl != null) { textEditor.Close(); } }
private void Ouvrir_Click(object sender, EventArgs e) { try { textEditorKMJOpenFileDialog.InitialDirectory = initialdirectory; if (textEditorKMJOpenFileDialog.ShowDialog() == DialogResult.OK) { if (textEditorKMJOpenFileDialog.FileName.EndsWith("rtf", StringComparison.CurrentCulture)) { TextEditorKMJ textEditor = new TextEditorKMJ(); textEditor.Text = textEditorKMJOpenFileDialog.FileName; textEditor.MdiParent = this; textEditor.textEditorRichTextBox.LoadFile(textEditorKMJOpenFileDialog.FileName); textEditor.textEditorRichTextBox.Modified = false; textEditor.Enregistre = true; textEditor.ModeInseree = true; textEditor.Show(); textEditorKMJOpenFileDialog.InitialDirectory = textEditorKMJOpenFileDialog.FileName; initialdirectory = textEditorKMJOpenFileDialog.FileName; ActiverOperationsMenusBarreOutils(); infoToolStripStatusLabel.Text = this.ActiveMdiChild.Text; } else { MessageBox.Show(g.tableauMessages[(int)ce.erreurMauvaiseExtension]); } } } catch (OutOfMemoryException) { MessageBox.Show(g.tableauMessages[(int)ce.erreurOutOfMemory]); } catch (System.IO.FileNotFoundException) { MessageBox.Show(g.tableauMessages[(int)ce.erreurFileNotFound]); } catch (ArgumentException) { MessageBox.Show(g.tableauMessages[(int)ce.erreurArgumentException]); } catch (Exception ex) { MessageBox.Show(g.tableauMessages[(int)ce.ouvrirErreur] + Environment.NewLine + ex.ToString()); } finally { textEditorKMJOpenFileDialog.Dispose(); } }
private void formatPoliceToolStripMenuItem_Click(object sender, EventArgs e) { TextEditorKMJ textEditor = this.ActiveMdiChild as TextEditorKMJ; RichTextBox rtf = textEditor.textEditorRichTextBox; try { textEditorFontDialog.Font = textEditor.textEditorRichTextBox.SelectionFont; if (textEditorFontDialog.ShowDialog() == DialogResult.OK) { rtf.SelectionFont = textEditorFontDialog.Font; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void Nouveau_Click(object sender, EventArgs e) { try { TextEditorKMJ textEditor = new TextEditorKMJ(); textEditor.MdiParent = this; textEditor.Text += " (" + TextEditorKMJ.numero.ToString() + ")"; ActiverOperationsMenusBarreOutils(); textEditor.ModeInseree = true; textEditor.Show(); infoToolStripStatusLabel.Text = this.ActiveMdiChild.Text; } catch (Exception ex) { MessageBox.Show(g.tableauMessages[(int)ce.creationTextEditorKMJ] + Environment.NewLine + ex.ToString()); } }
private void StylePolice_Click(object sender, EventArgs e) { try { TextEditorKMJ oTextEditor = this.ActiveMdiChild as TextEditorKMJ; if (sender == grasToolStripButton) { oTextEditor.ChangerAttributsPolice(FontStyle.Bold); } else if (sender == italiqueToolStripButton) { oTextEditor.ChangerAttributsPolice(FontStyle.Italic); } else { oTextEditor.ChangerAttributsPolice(FontStyle.Underline); } } catch (Exception ex) { MessageBox.Show(g.tableauMessages[(int)ce.changerStyleErreur] + Environment.NewLine + ex.ToString()); } }