Beispiel #1
0
        public void GetConsoleFontSize()
        {
            SafeConsoleHandle handle = CreateConsoleScreenBuffer(ConsoleAccess.GENERIC_READ);

            var fontInfo = new ConsoleFontInfo();
            bool result = WinConsole.GetCurrentConsoleFont(handle, false, fontInfo);
            Assert.That(result, Is.True);
            Trace.WriteLine(TestHelpers.ObjectToString(fontInfo));

            Coord coord = WinConsole.GetConsoleFontSize(handle, fontInfo.nFont);
            Trace.WriteLine(TestHelpers.ObjectToString(coord));

            Assert.That((coord.X > 0) || (coord.Y > 0));
        }
Beispiel #2
0
        /// <summary>
        /// Retrieves information about the current console font.
        /// </summary>
        /// <param name="hConsoleOutput">
        /// [in] A handle to the console screen buffer. The handle must have the <see cref="ConsoleAccess.GENERIC_READ"/>
        /// access right.
        /// </param>
        /// <param name="bMaximumWindow">
        /// [in] If this parameter is <c>TRUE</c>, font information is retrieved for the maximum window size. If this
        /// parameter is <c>FALSE</c>, font information is retrieved for the current window size.
        /// </param>
        /// <returns>
        /// A <see cref="ConsoleFontInfo"/> structure that receives the requested font information.
        /// </returns>
        public static ConsoleFontInfo GetCurrentConsoleFont(SafeConsoleHandle hConsoleOutput, bool bMaximumWindow)
        {
            var lpConsoleCurrentFont = new ConsoleFontInfo();
            WinError.ThrowLastWin32ErrorIfFailed(
                GetCurrentConsoleFont(hConsoleOutput, bMaximumWindow, lpConsoleCurrentFont));

            return lpConsoleCurrentFont;
        }
Beispiel #3
0
        public void GetCurrentConsoleFont()
        {
            SafeConsoleHandle handle = CreateConsoleScreenBuffer(ConsoleAccess.GENERIC_READ);

            var info = new ConsoleFontInfo();
            bool result = WinConsole.GetCurrentConsoleFont(handle, false, info);
            Trace.WriteLine(TestHelpers.ObjectToString(info));

            Assert.That(result, Is.True);
        }