private void fontToolStripMenuItem_Click(object sender, EventArgs e) { try { FontDialog dlgFontChooser = new FontDialog(); Font textFont = builder.GetSelectedTextFont(); if (textFont != null) { dlgFontChooser.Font = textFont; } if (dlgFontChooser.ShowDialog() == DialogResult.OK) { Font selectedFont = dlgFontChooser.Font; string fontName = selectedFont.Name;; builder.ChangeFontFamily(fontName); double fontSize = Math.Ceiling((double)selectedFont.Size); builder.ChangeFontSize(fontSize.ToString()); builder.MakeSelectionBold(!selectedFont.Bold); builder.MakeSelectionItalic(!selectedFont.Italic); builder.MakeSelectionStrikeout(!selectedFont.Strikeout); builder.MakeSelectionUnderlined(!selectedFont.Underline); modifiedDocument = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }