Beispiel #1
0
        /// <summary>
        /// 构建控制台
        /// </summary>
        /// <param name="consoleType">控制台类型</param>
        /// <param name="bold">字体粗细</param>
        /// <param name="maximum">最大化</param>
        /// <param name="width">宽度</param>
        /// <param name="height">高度</param>
        /// <param name="title">标题</param>
        /// <returns>是否成功</returns>
        public static void Construct(ConsoleType consoleType, bool bold, bool maximum,
                                     short width, short height, string title = "Destroy")
        {
            SetConsoleSetting(title);

            switch (consoleType)
            {
            case ConsoleType.Default:
                SetFontAndWindow("Consolas", bold, 16, 16, maximum, width, height);
                break;

            case ConsoleType.Chinese:
                SetFontAndWindow("新宋体", bold, 16, 16, maximum, width, height);
                break;

            case ConsoleType.Pixel:
                SetFontAndWindow("Terminal", bold, 8, 8, maximum, width, height);
                break;

            case ConsoleType.HignQuality:
                SetFontAndWindow("MS Gothic", bold, 1, 1, maximum, width, height);
                break;
            }

            if (maximum)
            {
                KERNEL.SET_WINDOW_POS(0, 0);
            }
            else
            {
                CONSOLE.CenterConsoleWindowPosition();
            }
            CONSOLE.CursorVisible = false;
        }
Beispiel #2
0
        /// <summary>
        /// 构建控制台
        /// </summary>
        /// <param name="fontName">字体名字</param>
        /// <param name="bold">字体粗细</param>
        /// <param name="fontWidth">字体宽度</param>
        /// <param name="fontHeight">字体高度</param>
        /// <param name="maximum">最大化</param>
        /// <param name="width">宽度</param>
        /// <param name="height">高度</param>
        /// <param name="title">标题</param>
        public static void Construct(string fontName, bool bold, short fontWidth, short fontHeight,
                                     bool maximum, short width, short height, string title = "Destroy")
        {
            SetConsoleSetting(title);

            SetFontAndWindow(fontName, bold, fontWidth, fontHeight, maximum, width, height);

            if (maximum)
            {
                KERNEL.SET_WINDOW_POS(0, 0);
            }
            else
            {
                CONSOLE.CenterConsoleWindowPosition();
            }
            CONSOLE.CursorVisible = false;
        }