473,395 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to get a system font ?

Hi,

In C++ I was used to this code to get a GUI system font :

LOGFONT lf;
::SystemParametersInfo(SPI_GETICONTITLELOGFONT,siz eof(LOGFONT),&lf,0);
HFONT hFont = ::CreateFontIndirect(&lf);

How can I get such a font in C# ?

Thank you

Herve
Nov 16 '05 #1
1 6058
Herve,

You can use the same API calls to get the handle to the font in .NET
(through the P/Invoke layer). Once you do that, you can create a Font
object by calling the static FromHfont method on the Font class, passing the
handle to the font.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Herve Bocuse" <gd******@gmail.com> wrote in message
news:cp**********@dns3.cae.ca...
Hi,

In C++ I was used to this code to get a GUI system font :

LOGFONT lf;
::SystemParametersInfo(SPI_GETICONTITLELOGFONT,siz eof(LOGFONT),&lf,0);
HFONT hFont = ::CreateFontIndirect(&lf);

How can I get such a font in C# ?

Thank you

Herve

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ian | last post by:
In Windows XP, there's an accessability wizard that allows the user to change the font size for readability. There's probably something similar in other operating systems. I think it would be a...
0
by: Hin | last post by:
How can i get the system font size in .NET? The font size i mean is the one in advanced display properties: 1. Right-click desktop 2. Click "Properties" item on context menu 3. On "Settings"...
1
by: Jon Pope | last post by:
I'm maintaining an internal tool within my organization. Some of my users have resized their system font size by changing the DPI setting from 96DPI to 120DPI (by right-clicking the desktop and...
1
by: VR | last post by:
I designed an ASP.NET page and in the IDE design view the page looks just fine. It also looks fine when I view it in the browser on my development PC. When I look at the same page, using the...
4
by: Dennis | last post by:
How do I get the System Font that is used in message boxes, etc. so I can set in code my control to use the same font? Thanks for any help. -- Dennis in Houston
0
by: Fuzzyman | last post by:
Hello all, I'm writing a windows application with a Tkinter GUI. Tkinter ignores the Windows user setting for system default font size - which can be 'normal', 'large' or 'extra large'. ...
4
by: Joseph Gruber | last post by:
Is there any way to use the 'System' Font for a label?
2
by: teo | last post by:
hallo, for a pop-up menu (it's a 'ContextMenuStrip' control) I 'd like to set the current System font Currently the ContextMenuStrip has the MS San Sarif font and the 8,25 size but I'd like...
1
by: Noozer | last post by:
I would like the font used on one of my forms to match whichever font the user has selected in their display properties. For example, I want the font on my textboxes to match the "menu" font. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.