Как изменить размер шрифта консоли с
Перейти к содержимому

Как изменить размер шрифта консоли с

  • автор:

Is it possible to get/set the console font size?

I have seen posts on changing console true type font and console colors (rgb) but nothing on setting or getting the console font size.

The reason I want to change the font size is because a grid is printed to the console, and the grid has many columns, so, it fits better with a smaller font. I’m wondering if it’s possible to change it at runtime rather than allowing the default or configured fonts to take priority / override inheritance.

Как изменить размер шрифта консоли

Как изменить размер шрифта в консольном приложении в Windows? Самый простой способ?
В чем разница между изменением цвета консоли с помощью system(«») и windows.h?

Решение

Вы можете изменить размер шрифта, используя SetCurrentConsoleFontEx ,
Ниже приведен небольшой пример, с которым вы можете поиграть, убедитесь, что вы #include <cwchar> а также #include <windows.h>

Если вы выбираете Arial или другие, вам, возможно, придется указать ширину шрифта. Для большего Информация .

Разница между system() звонки и использование Windows.h в том, что system() звонки ресурсоемки и небезопасны. Дополнительная информация Вот.

Как изменить размер шрифта консоли с

As implied from the title, is there any system(«»); commands to alter the font size whilst running the program?

Otherwise my console app will be difficult to read for some users.

I already manipulate the colour scheme with system(«color xy»);

Where x and y represent different colour codes. But is there a way to do the same sort of thing but increasing the actual font size instead?

Thank you for any help you can provide 🙂

When you try changing font size, you should first get the CONSOLE_FONT_INFOEX structure with GetCurrentConsoleFontEx, change the size member and then call SetCurrentConsoleFontEx.

I am sorry but that didn’t make much sense to me at all :S

I have not progressed into HANDLE’s properly yet and have only touched on them whilst using them to set/get clipboard text.

When getting the CONSOLE_FONT_INFOEX structure what do I need to set it to?

Will the following be what I need?

No. Are you unfamiliar with structs? If so, you may want to read this: http://www.cplusplus.com/doc/tutorial/structures/

here’s a full example. I can’t say if it works, because apparently functions Get/SerCurrentConsoleFontEx are only available in windows vista and later.

можно получить / установить размер шрифта консоли в c#.net?

Я видел сообщения об изменении шрифта истинного типа консоли, цвета консоли (rgb), но ничего при настройке или получении размера шрифта консоли. edit: reason = grid выводится на консоль, grid имеет много столбцов, лучше вписывается в меньший шрифт, задаваясь вопросом, Можно ли изменить во время выполнения, а не разрешать приоритет / переопределение наследования по умолчанию или настроенным шрифтам.

2 ответов

может быть этой статья может помочь вам

важнейшие функции: SetConsoleFont , GetConsoleFontInfo и GetNumberOfConsoleFonts . Они недокументированы, поэтому используйте на свой страх и риск.

консоль не поддерживает изменение размера шрифта во время выполнения. Список доступных способов изменения текущих настроек консоли windows можно найти на MSDN. Насколько я понимаю, это потому, что:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *