I'm having problems here, C++ Win32 GUI programming is hard!
Problem #1: When i created the project in visual studio, it gave me some code that produced the main window. The code specifies the background colour for the window class as COLOR_WINDOW+1. However, here on Windows 7, that's white! I'd really like it to be light grey as per the norm. I can get this with COLOR_WINDOW without the '+1'. But i'm worried about the effect of this across other versions of windows and custom themes. Is this the recommended solution, or should I do it a different way?
Problem #2: More importantly, I'm having trouble with fonts! I've created a new window (an actual window, not a dialog), and created a button on it. The font used for the button is a really old system font (bold, black, and blocky). How do I get the window and all of it's controls to take on the default system font (Segoe UI for win7)? I've spent hours on this and haven't come up with an answer yet :(
SYSTEM_FONT and DEFAULT_GUI_FONT are apparently obsolete. I've heard about a SystemParametersInfo() function, NONCLIENTMETRICS sturctures and LOGFONTs. Am I going down the right path with that? How does this help me? Do i want lfMessageFont ("information about the font used in message boxes")????
I'm doing everything the hard way btw. Plain old C++, Win32, no MFC, no "forms", no dialog boxes designed in a resource file, and it's my first gui app using C++.
Question
+theblazingangel MVC
I'm having problems here, C++ Win32 GUI programming is hard!
Problem #1: When i created the project in visual studio, it gave me some code that produced the main window. The code specifies the background colour for the window class as COLOR_WINDOW+1. However, here on Windows 7, that's white! I'd really like it to be light grey as per the norm. I can get this with COLOR_WINDOW without the '+1'. But i'm worried about the effect of this across other versions of windows and custom themes. Is this the recommended solution, or should I do it a different way?
Problem #2: More importantly, I'm having trouble with fonts! I've created a new window (an actual window, not a dialog), and created a button on it. The font used for the button is a really old system font (bold, black, and blocky). How do I get the window and all of it's controls to take on the default system font (Segoe UI for win7)? I've spent hours on this and haven't come up with an answer yet :(
SYSTEM_FONT and DEFAULT_GUI_FONT are apparently obsolete. I've heard about a SystemParametersInfo() function, NONCLIENTMETRICS sturctures and LOGFONTs. Am I going down the right path with that? How does this help me? Do i want lfMessageFont ("information about the font used in message boxes")????
I'm doing everything the hard way btw. Plain old C++, Win32, no MFC, no "forms", no dialog boxes designed in a resource file, and it's my first gui app using C++.
Please help...
Link to comment
https://www.neowin.net/forum/topic/817606-c-win32-windowcontrol-font-background-colour/Share on other sites
12 answers to this question
Recommended Posts