I want all the controls (edit,list control, etc) in my application to be having the same font which is not the system default. How do i do this? Is there any Win32 API that sets the application default font?
Windows 10's default system font, Segoe UI, looks pretty nice. However, if you have something better to replace it with, you can change the default system font on your Windows 10 PC.
Open Start. Search for Notepad and click the top result to open the text editor. Copy and paste the following Registry code onto the file:Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]"Segoe UI (TrueType)"="segoeui. ttf""Segoe UI Black (TrueType)"="seguibl.
Steps to change the default font in Windows 10Step 1: Launch the Control Panel from the Start Menu. Step 2: Click on the “Appearance and Personalization” option from the side menu. Step 3: Click on “Fonts” to open fonts and select the name of the one you want to use as default.
Go to Format > Font > Font. + D to open the Font dialog box. Select the font and size you want to use. Select Default, and then select Yes.
Implement this:
bool CALLBACK SetFont(HWND child, LPARAM font){
SendMessage(child, WM_SETFONT, font, true);
return true;
}
inside a separate file or just in the main.cpp and then just run:
EnumChildWindows(hwnd, (WNDENUMPROC)SetFont, (LPARAM)GetStockObject(DEFAULT_GUI_FONT));
whenever you want, for example in the WM_CREATE
message, after you've created all your child windows!
I always have a SetFont.cpp
and a SetFont.h
in my win32 GUI application solutions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With