• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 389
  • Last Modified:

How to set the FontDialog-component to a certain fontname/size by pressing on a button.

Hi Experts,

I am programming in VS2010 and I am using C#.
On my dialog-form I have a Button, editbox(readonly) and
a FontDialog-component.

A user can press the button and the FontDialog-window
appears the user can then set his fontname, size etc...
After closting the fontdialog-window, the choosen Font-
Name and size appears in the editbox.

        private void btnFontType_Click(object sender, EventArgs e)
            if (fontDialog1.ShowDialog() == DialogResult.OK)
                txtFont.Text = Convert.ToInt32(this.fontDialog1.Font.SizeInPoints).ToString() + " pt. " +

Open in new window

What I would like is to create a button called Default, that sets the fontdialog to
the default fontname: Microsoft Sans Serif and default fontsize: 8.

How can I do that?


Peter Kiers
1 Solution
Jacques Bourgeois (James Burger)PresidentCommented:
FontDialog1.Font = New Font("Microsoft Sans Serif", 8)
peterkiersAuthor Commented:
Thanks. Peter
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now