windows 有没有办法使 c++ 控制台文本更大?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6837919/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 17:37:44  来源:igfitidea点击:

Is there a way to make c++ console text larger?

c++windowsuser-interfaceconsole

提问by Jono_2007

I'm making a random number generator, the program will create several random numbers and then choose from those random numbers and then displays that number in the window.

我正在制作一个随机数生成器,程序将创建几个随机数,然后从这些随机数中进行选择,然后在窗口中显示该数字。

I was wondering if there was a way to make that specific piece of text bigger? I don't want to change the size of all of the text in the window as I have writing in the window that i don't want to change the size of

我想知道是否有办法使该特定文本更大?我不想更改窗口中所有文本的大小,因为我在窗口中写了我不想更改的大小

Thanks for any help you can give

谢谢你提供的所有帮助

回答by Tim

No, but you can make it bold, change the font color, or the background color for the specific text. If all you want is to make that specific piece of text stand out, I'd go with colorizing it.

不,但您可以将其设为粗体、更改字体颜色或特定文本的背景颜色。如果你只想让那段特定的文字脱颖而出,我会去给它上色。

As for how to do that... It's platform dependent. What platform are you on? Windows? Linux? What shell?

至于如何做到这一点......它依赖于平台。你在什么平台?视窗?Linux?什么壳?

Take a look at the Windows Console API. That should have what you need.

看一看Windows 控制台 API。那应该有你需要的。

回答by D.N.

Console text doesn't allow for the rich formatting you are referring to. You would have to move to a graphical output to render the size differences.

控制台文本不允许您所指的丰富格式。您必须移至图形输出以呈现大小差异。

回答by Colin Valliant

Generally, programs can't control the size of the text in the terminal. You may be able to change the color of a specific part of the text, though. Search for terminal escape sequences for information on how to do that on various terminals. Some terminals also handle bold, italics, and underlining.

通常,程序无法控制终端中文本的大小。不过,您或许可以更改文本特定部分的颜色。搜索终端转义序列以获取有关如何在各种终端上执行此操作的信息。一些终端还处理粗体、斜体和下划线。

回答by siemanko

No, but instead you can change colors of text and text's background. Will this be a good solution for your problem? There are a lot of specific examples available in the internet.

不可以,但您可以更改文本颜色和文本背景。这会是您问题的一个很好的解决方案吗?互联网上有很多具体的例子。

回答by Greg Hewgill

A possible console mode solution could involve FIGlet. You can tweak the output to write in many different fonts.

可能的控制台模式解决方案可能涉及FIGlet。您可以调整输出以使用多种不同的字体书写。

The output is larger, but no guarantee that it's suitable for your application.

输出更大,但不能保证它适合您的应用程序。

回答by Andriy Tylychko

open your console app, go to system menu of console window (left top corner, right click), font tab, choose what you wish. next time you open this (!) console app the font will be as you selected, other console windows are not affected

打开您的控制台应用程序,转到控制台窗口的系统菜单(左上角,右键单击),字体选项卡,选择您想要的。下次打开这个 (!) 控制台应用程序时,字体将与您选择的一样,其他控制台窗口不受影响

回答by SimkaTheBoss

  1. Right Click the top bar of the window

    select top bar

  2. Click Properties

  3. Click Font and select your font size

  1. 右键单击窗口的顶部栏

    选择顶部栏

  2. 单击属性

  3. 单击字体并选择您的字体大小

select font size

选择字体大小

This isn't through the code but it will help for your pc.

这不是通过代码,但它会帮助你的电脑。