Link to home
Start Free TrialLog in
Avatar of Peter Kiers
Peter KiersFlag for Netherlands

asked on

Saving fontname and fontsize to the settings-file.

Dear Experts,

I have a fontDialog1 on my form that can be called by pressing on a button.
The user than can choose his/her favorite fontname and fontsize.
What I would like is to save the fontname and size to the settings-file
when the OK-button of the fontdialog1 is pressed.

How can I do that?

private void btnLetType_Click(object sender, EventArgs e)
        {
            if (fontDialog1.ShowDialog() == DialogResult.OK)
            {
                  //
            }
        }

peter
ASKER CERTIFIED SOLUTION
Avatar of x77
x77
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kaufmed
How is this question different than your previous question?
Avatar of Peter Kiers

ASKER

I have this:

        private void button1_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.MyFont = fontDialog1.Font;
          Properties.Settings.Default.Save();
        }
        //*-----------------------------------------------------------*//
        private void Settings_Load(object sender, EventArgs e)
        {
            fontDialog1.Font = Properties.Settings.Default.MyFont;
        }
        //*-----------------------------------------------------------*//

and it works. Thank you.

Peter
Csharp:

            Properties.Settings.Default.MyFont = fontDialog1.Font;
            Properties.Settings.Default.Save();