Ejemplo n.º 1
0
        public static void SetFontAndWindow(string fontName, bool bold, short fontWidth, short fontHeight, bool maximum, short width, short height)
        {
            CONSOLE.SetConsoleFont(CONSOLE.OutputHandle, bold, fontWidth, fontHeight, fontName);

            KERNEL.GET_LARGEST_CONSOLE_WINDOW_SIZE(CONSOLE.OutputHandle,
                                                   out short largestWidth, out short largestHeight);

            if (maximum)
            {
                width  = largestWidth;
                height = largestHeight;
            }
            else if (width > largestWidth || height > largestHeight)
            {
                Error.Pop("specific width/height is too big!");
            }

            //如果发生报错, 尝试使用或禁用下面这行代码
            KERNEL.SET_CONSOLE_WINDOW_SIZE(CONSOLE.OutputHandle, 1, 1);
            CONSOLE.BufferWidth  = width;
            CONSOLE.WindowWidth  = width;
            CONSOLE.BufferHeight = height;
            CONSOLE.WindowHeight = height;
        }