Ejemplo n.º 1
0
        public static CONSOLE_FONT_INFOEX GetCurrentConsoleFontEx()
        {
            // Instantiating CONSOLE_FONT_INFOEX and setting cbsize
            CONSOLE_FONT_INFOEX ConsoleFontInfo = new CONSOLE_FONT_INFOEX();

            ConsoleFontInfo.cbSize = (uint)Marshal.SizeOf(ConsoleFontInfo);

            GetCurrentConsoleFontEx(GetStdHandle(StdHandle.OutputHandle), false, ref ConsoleFontInfo);
            return(ConsoleFontInfo);
        }
Ejemplo n.º 2
0
        public static void SetCurrentConsoleFontEx(short sizeX = 6, short sizeY = 8, string faceName = "Lucida Console")
        {
            // Instantiating CONSOLE_FONT_INFO_EX and setting its size (the function will fail otherwise)
            CONSOLE_FONT_INFOEX ConsoleFontInfo = new CONSOLE_FONT_INFOEX();

            ConsoleFontInfo.cbSize = (uint)Marshal.SizeOf(ConsoleFontInfo);

            // Optional, implementing this will keep the fontweight and fontsize from changing
            // See notes
            // GetCurrentConsoleFontEx(GetStdHandle(StdHandle.OutputHandle), false, ref ConsoleFontInfo);

            ConsoleFontInfo.FaceName     = faceName;
            ConsoleFontInfo.dwFontSize.X = sizeX;
            ConsoleFontInfo.dwFontSize.Y = sizeY;

            SetCurrentConsoleFontEx(GetStdHandle(StdHandle.OutputHandle), false, ref ConsoleFontInfo);
        }
Ejemplo n.º 3
0
 static extern Int32 SetCurrentConsoleFontEx(
     IntPtr ConsoleOutput,
     bool MaximumWindow,
     ref CONSOLE_FONT_INFOEX ConsoleCurrentFontEx);
Ejemplo n.º 4
0
 extern static bool GetCurrentConsoleFontEx(
     IntPtr hConsoleOutput,
     bool bMaximumWindow,
     ref CONSOLE_FONT_INFOEX lpConsoleCurrentFont);