简体   繁体   English

如何在C程序中修复输出控制台窗口的大小/形状?

[英]How to fix size/shape of output console windows in c program?

I am making one C program in which I want the function or any method to fix size of output console window. 我正在制作一个C程序,在该程序中我需要函数或任何方法来固定输出控制台窗口的大小。 Is there any function or way in C language to perform this task? 用C语言有什么功能或方法可以执行此任务吗?

Generally the shape of output console is rectangle but to display proper output of my program I want to fix the square shape so I want to re size the output console using the programming. 通常,输出控制台的形状是矩形,但是为了显示程序的正确输出,我想固定正方形,因此我想使用编程来调整输出控制台的大小。

I am using GNU GCC compiler and Os is Microsoft Windows 8.1. 我正在使用GNU GCC编译器,操作系统是Microsoft Windows 8.1。

C language don't have any function to control console property but you can use windows header file to control console. C语言没有任何功能来控制控制台属性,但是您可以使用Windows头文件来控制控制台。

You can get a handle to the console window using GetConsoleWindow . 您可以使用GetConsoleWindow获取控制台窗口的句柄

Once you have that, you should be able to resize it using SetWindowPos 一旦有了它,您应该可以使用SetWindowPos调整它的大小。

You may also need to resize the buffer for the console using SetConsoleScreenBufferSize prior to resizing the window. 在调整窗口大小之前,您可能还需要使用SetConsoleScreenBufferSize调整控制台缓冲区的大小。

Visit 访问

不,用C语言没有任何功能或方法可以改变控制台的形状。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM