Click here to Skip to main content
15,896,478 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hy
How can I make bigger font in console application window?
I am using Visual Studio 2012.

Thank You
Posted
Updated 25-Jul-13 7:37am
v3

One of the examples on this page[^] shows how to change the console font.
 
Share this answer
 
Comments
Miljenko1 25-Jul-13 14:08pm    
Maybe I should try in Tools -> Options -> Environment -> Fonts and Colors
Sergey Alexandrovich Kryukov 25-Jul-13 17:03pm    
Exactly. This is where it is explained. My 5.
—SA
I right clicked on console windows and Properties. There You can change font size.
 
Share this answer
 
In C++ you can check out the
SetCurrentConsoleFontEx[^]

In C# you can use this

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;
			}
		}

	}
}


You should take a look in your registry at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont

to find out what fonts your computer can support.
 
Share this answer
 
Comments
Miljenko1 25-Jul-13 14:09pm    
Maybe I should try in Tools -> Options -> Environment -> Fonts and Colors
[no name] 26-Jul-13 8:33am    
i think that will only work on your local machine not sure if it will work on a different computer
ggiacomoo 16-Apr-14 9:50am    
How can change size of font in c# ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900