Current location - Health Preservation Learning Network - Slimming men and women - How to change font color and size in C++
How to change font color and size in C++
When you say that the program runs in a black window, I think I understand what you mean. You are programming using the console, which means that you are building win32.

comfort

Because the application project is programmed by console, the pop-up window is a DOS window with white characters on black background, which cannot be set on the compiler. But it can be changed by specific program code, that is, using console API functions, but it is very limited. After all, it is not windows programming. As you said, to change the background, you can use system("color.

") This system is implemented by API function, but it is basically impossible to insert the background into the picture you want. After all, the console program is a character program, and it is impossible to display a bitmap under the character program. You can change the font color. You can use the API function SetConsoleTextAttribute to set the font color. You can also print color words directly with two API functions, FillConsoleOutputAttribute and WriteConsoleOutputCharacter, or print color modules with FillConsoleOutputAttribute alone under the fixed coordinates of the console, but it is impossible to change the font size, because the console is only data output, and the characters are fixed and cannot be changed by the operating system.