?
Solved

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

Posted on 2012-03-13
2
Medium Priority
?
376 Views
Last Modified: 2012-03-13
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. " +
                fontDialog1.Font.Name;
            }
        }

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?

Greetings,

Peter Kiers
0
Comment
Question by:peterkiers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 2000 total points
ID: 37713902
FontDialog1.Font = New Font("Microsoft Sans Serif", 8)
            FontDialog1.ShowDialog()
0
 
LVL 1

Author Comment

by:peterkiers
ID: 37714012
Thanks. Peter
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question