Default font

G

Guest

Hi, I'm writing a small component. This component have to display some text
so I have override OnPaint event and I've used DrawString method. No problem
here.

On DrawString I need to set a Font and I would like to use the operating
system default font. How can I get the name, the size and the style of
default font ?

I've seen that for PPC the default seems to be "Tahoma",9,Bold but for WinCE
seems to be "Tahoma",10.

Is there a way to know the default font used by the operating system ?

Thank you in advance.

Keven Corazza
 
A

Alex Feinman [MVP]

GetStockObject(DEFAULT_GUI_FONT) then GetObject(hFont, &LOGFONT)
Once you got the LOGFONT, calculate the .NET font size as

Size = lf.lfHeight / 12.0 * 8.0
 
G

Guest

It's probably in the registry as well.

-Chris


Alex Feinman said:
GetStockObject(DEFAULT_GUI_FONT) then GetObject(hFont, &LOGFONT)
Once you got the LOGFONT, calculate the .NET font size as

Size = lf.lfHeight / 12.0 * 8.0
 
G

Guest

how to set Arial to default system by registry with C#?
can you help me with some code?
 

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