public static extern bool AllocConsole (); / / start window
[DllImport ("kernel32.dll")]
public static extern bool FreeConsole (); / / Close window
invoked this way , how to set the c # console length and width of it ? His cache settings and aspect
is user32.dll or kernel32.dll
how great God who set up seeking help
------ Solution ------------------------------ --------------
without calling dll 's
You only need to do this :
//在调用打开控制台后就可以用Console类来设置控制台缓冲区大小和窗口大小、颜色什么的了
AllocConsole();
//这样就可以设置了
Console.SetBufferSize(ConsoleBufferSizeWidth,ConsoleBufferSizeHeight);
Console.SetWindowSize(ConsoleWindowSizeWidth,ConsoleWindowSizeHeight);
关闭:
FreeConsole();
------ For reference only ----------------------------------- ----
ConsoleBufferSizeWidth
ConsoleBufferSizeHeight
buffer size depends on the font size and screen resolution, window size depends on the buffer, so there is a limited range of values
------ For reference only -------- -------------------------------
Console.SetBufferSize but Console.SetWindowSize buffer can be set , the framework is still the same size.
------ For reference only -------------------------------------- -
try to maximize ( 12801024 )
Console.SetBufferSize (160,53);
Console.SetWindowSize (160,53);
------ For reference only ------------------------- --------------
well, thank you, solved, know where the problem
没有评论:
发表评论