Determine the font of the messageboxes

Hi All,

I have a very basic Windows based .net application in which I have used messageboxes.  How can I determine/know the font of the messageboxes ?

OS used : Windows Server 2008 r2
ankurdkAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
do you have the source code? if so open the solution in Visual Studio. click on the control and look at its properties.
AndyAinscowFreelance programmer / ConsultantCommented:
That should be a system setting for a standard message box.  You can look at the font settings to determine which it is.
Fernando SotoRetiredCommented:
Hi ankurdk;

The MessageBox only has a few properties that are available to be set or gotten but the Font is not one of them. So in answer to your question you can't. If you need that functionality you will need to create your own dialog box.
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

DarrenSenior Software EngineerCommented:
Hi,

As far as I am aware the default MessageBox will use the system font and size.

There is a static class SystemFonts that might be of help

Namespace:
    System.Windows

Assembly:
    PresentationFramework.dll

Contains properties that expose the system resources that concern fonts.

There is also one that exposes the MessageFontSize

SystemFonts.MessageFontSize

Hope this helps,

Thanks,

Darren

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Chinmay PatelChief Technical NinjaCommented:
Hi ankurdk,

If you used MessageBox.Show method and did not have your own custom message boxes or (any other mechanism to override default system behavior) - your messagebox would use the fonts defined by the system.

Regards,
Chinmay.
Don VonderBurgPresident/CEOCommented:
The standard MessageBox has limited settings. I wrote my own MessageBox routine and use that in all cases. I have more control that way.
ankurdkAuthor Commented:
Thanks All for your insights.  As precisely put by @Darren, there is a property SystemFonts.MessageBoxFont which does give the name of the font (in this case it is Tahoma) using the following VB.NET code :

Messagebox.Show(SystemFonts.MessageBoxFont.ToString)

So, technically, is this the system font. If so, can we change it ?
AndyAinscowFreelance programmer / ConsultantCommented:
As it is a system setting I would strongly recommend you do NOT change it.
ankurdkAuthor Commented:
Again, I thank all for their prompt valuable inputs.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.