Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6091825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:22:20+00:00 2026-05-23T12:22:20+00:00

I have seen posts on changing console true type font and console colors (rgb)

  • 0

I have seen posts on changing console true type font and console colors (rgb) but nothing on setting or getting the console font size.

The reason I want to change the font size is because a grid is printed to the console, and the grid has many columns, so, it fits better with a smaller font. I’m wondering if it’s possible to change it at runtime rather than allowing the default or configured fonts to take priority / override inheritance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:22:21+00:00Added an answer on May 23, 2026 at 12:22 pm

    Maybe this article can help you

    ConsoleHelper.cs

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.InteropServices;
    using System.Drawing;
    
    namespace ConsoleExtender {
        [StructLayout(LayoutKind.Sequential, Pack = 1)]
        public struct ConsoleFont {
            public uint Index;
            public short SizeX, SizeY;
        }
    
        public static class ConsoleHelper {
            [DllImport("kernel32")]
            public static extern bool SetConsoleIcon(IntPtr hIcon);
    
            public static bool SetConsoleIcon(Icon icon) {
                return SetConsoleIcon(icon.Handle);
            }
    
            [DllImport("kernel32")]
            private extern static bool SetConsoleFont(IntPtr hOutput, uint index);
    
            private enum StdHandle {
                OutputHandle = -11
            }
    
            [DllImport("kernel32")]
            private static extern IntPtr GetStdHandle(StdHandle index);
    
            public static bool SetConsoleFont(uint index) {
                return SetConsoleFont(GetStdHandle(StdHandle.OutputHandle), index);
            }
    
            [DllImport("kernel32")]
            private static extern bool GetConsoleFontInfo(IntPtr hOutput, [MarshalAs(UnmanagedType.Bool)]bool bMaximize, 
                uint count, [MarshalAs(UnmanagedType.LPArray), Out] ConsoleFont[] fonts);
    
            [DllImport("kernel32")]
            private static extern uint GetNumberOfConsoleFonts();
    
            public static uint ConsoleFontsCount {
                get {
                    return GetNumberOfConsoleFonts();
                }
            }
    
            public static ConsoleFont[] ConsoleFonts {
                get {
                    ConsoleFont[] fonts = new ConsoleFont[GetNumberOfConsoleFonts()];
                    if(fonts.Length > 0)
                        GetConsoleFontInfo(GetStdHandle(StdHandle.OutputHandle), false, (uint)fonts.Length, fonts);
                    return fonts;
                }
            }
    
        }
    }
    

    Here is how to use it to list true type fonts for console,

    static void Main(string[] args) {
       var fonts = ConsoleHelper.ConsoleFonts;
       for(int f = 0; f < fonts.Length; f++)
          Console.WriteLine("{0}: X={1}, Y={2}",
             fonts[f].Index, fonts[f].SizeX, fonts[f].SizeY);
    
       ConsoleHelper.SetConsoleFont(5);
       ConsoleHelper.SetConsoleIcon(SystemIcons.Information);
    }
    

    Crucial functions: SetConsoleFont, GetConsoleFontInfo and GetNumberOfConsoleFonts. They’re undocumented, so use at your own risk.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen a few posts regarding this issue but not one specific to
I have seen many posts about this problem but didn't get an answer. I
I have seen many posts and questions about Mocking a private method but still
I have seen other posts on this site with answers, but I think I
I have seen other posts , but they are mostly in C#. For someone
I have seen other posts on this subject, but this seems different. I am
I've already seen this post: Changing the size of Html.TextBox But I cannot change
I have seen numerous posts about the IE Webpage has expired error message, but
I have seen many posts about when to use ViewBag/ViewData vs ViewModel but i
I have seen some posts about navigation and breadcrumbs but did not find the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.