private void btnSelectFont_Click(object sender, System.EventArgs e) { try { fdlgText.Font = txtFileContents.Font; fdlgText.Color = txtFileContents.ForeColor; fdlgText.ShowColor = true; fdlgText.ShowApply = true; fdlgText.ShowEffects = true; fdlgText.ShowHelp = true; fdlgText.AllowScriptChange = true; fdlgText.AllowSimulations = false; fdlgText.AllowVectorFonts = false; fdlgText.AllowVerticalFonts = false; fdlgText.FixedPitchOnly = false; fdlgText.FontMustExist = true; fdlgText.MaxSize = 48; fdlgText.MinSize = 8; if (fdlgText.ShowDialog() == DialogResult.OK) { ApplyFontAndColor(); } } catch (Exception exp) { MessageBox.Show(exp.Message, this.Text); } }
private void ApplyFontAndColor() { try { txtFileContents.Font = fdlgText.Font; if (fdlgText.ShowColor) { txtFileContents.ForeColor = fdlgText.Color; } } catch (Exception exp) { MessageBox.Show(exp.Message, this.Text); } }