// There are two font functions.
        // GetCurrentConsoleFont returns a ConsoleFontInfo class that
        // contains the number and size for the current font in a maximized or not window.
        // GetConsoleFontSize returns the size for a given font id.
        // I'm just going to implement GetFontSize to return the size of the current font.
        public Coord GetFontSize()
        {
            ConsoleDisplayMode cMode = DisplayMode;
            bool bMax = (cMode & ConsoleDisplayMode.Fullscreen) != 0;

            return(GetFontSize(bMax));
        }
        /// <summary>
        /// Sets the console display mode.
        /// </summary>
        /// <param name="mode">The desired display mode:  Windowed or Fullscreen.</param>
        public void SetDisplayMode(ConsoleDisplayMode mode)
        {
            Coord newSize = new Coord(0, 0);

            if (!WinCon.SetConsoleDisplayMode(this.handle, (int)mode, ref newSize))
            {
                int err = Marshal.GetLastWin32Error();
                throw new IOException("Unable to set display mode.", err);
            }
        }
Beispiel #3
0
 public static extern bool GetConsoleDisplayMode(out ConsoleDisplayMode lpModeFlags);
Beispiel #4
0
        /// <summary>
        /// Sets the display mode of the specified console screen buffer.
        /// </summary>
        /// <param name="hConsoleOutput">
        /// [in] A handle to the console screen buffer.
        /// </param>
        /// <param name="dwFlags">
        /// [in] The display mode of the console.
        /// </param>
        /// <returns>
        /// A <see cref="Coord"/> structure that receives the new dimensions of the screen buffer, in characters.
        /// </returns>
        public static Coord SetConsoleDisplayMode(SafeConsoleHandle hConsoleOutput, ConsoleDisplayMode dwFlags)
        {
            Coord lpNewScreenBufferDimensions;
            WinError.ThrowLastWin32ErrorIfFailed(
                SetConsoleDisplayMode(hConsoleOutput, dwFlags, out lpNewScreenBufferDimensions));

            return lpNewScreenBufferDimensions;
        }
Beispiel #5
0
 public static extern bool SetConsoleDisplayMode(
     SafeConsoleHandle hConsoleOutput,
     ConsoleDisplayMode dwFlags,
     out Coord lpNewScreenBufferDimensions);
 /// <summary>
 /// Sets the console display mode.
 /// </summary>
 /// <param name="mode">The desired display mode:  Windowed or Fullscreen.</param>
 public void SetDisplayMode(ConsoleDisplayMode mode)
 {
     Coord newSize = new Coord(0, 0);
     if (!WinCon.SetConsoleDisplayMode(this._handle, (int)mode, ref newSize))
     {
         int err = Marshal.GetLastWin32Error();
         throw new IOException("Unable to set display mode.", err);
     }
 }
 public static extern bool GetConsoleDisplayMode(out ConsoleDisplayMode dwFlags);