windows default font

G

Guest

How do i set for my application to use the default System font instead of
Microsoft Sans Serif so i don't need to worry about changing the the font
field in the properties when inserting controls to the form.
Sometimes users change the look of the windows and i want my application to
take the same font, not the one that is in the Font field of the properties
window in Visual Studio.

Im working with VS 2005

Thanks!
 
S

Stoitcho Goutsev \(100\)

Hi,

If the font property of a control is not set it uses the fon't set for its
parent. That means if you don't set the control's property when add then to
a form they are going to use the form's font, thus changing the form's font
will affect all the controls on the form.

When the form is created thoungh if its form is not set it uses the font
from the Control.DefaultFont static proeprty. Internally the property does
some probing and it should use the system default font unless the system
settings are not for Arabic or Japanese languages. Control.DefaultFont on
the other hand returns system's DEFAULT_GUI_FONT that as documented always
return MS Sans Serif.

So the question is what is the default system font? According to windows
this is MS Sans Serif.
 
G

Guest

maybe i didn't explain this very well

for example:
when you change the appearance in your Display settings Visual Studio take
these values and they are applied to IDE Interface. How can I do the same
thing for my projects?

Thanks
 
S

Stoitcho Goutsev \(100\)

As far as I can see windwos forms application (at least the one build with
v2.0) reflect all the system settings changes.

Actually there is not much that you can change there. These are mostly
nonclient colors and fonts. Anyways when the some changes are done OS sends
WM_SETTINGCHANGE message to all toplevel windows. Most of the fonts changes
are notified via the SPI_SETNONCLIENTMETRICS item.

WinXP also sends WM_THEMECHANGED message.

Some of the system settings can be obtained in managed code using
SystemInformation class for the rest SystemParametersInfo API should be
used.
 
G

Guest

Hi,

I have a related question. Can this be done in .NET Framework 1.1? I am
using Visual Studio 2003 and .NET Framework 1.1.4322 SP1 specifically. When
running on Simplifed Chinese Windows XP/2000, can I get the application to
detect font changes and use the same default font?

Currently, I don't hard-code the font in any GUI screens (UserControls), yet
some of them use the new system font and some screens (and all Forms) use the
OLD system default font.

TIA,
Aaron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top