How to Change Font Size in C# Console Application

#1

  • D.I.C Head

Reputation: -3

  • View blog
  • Posts: 181
  • Joined: 18-May 08

Console Application Font Size

Posted 25 October 2010 - 04:26 AM

Hello everyone,
Is there a possibility of having a console application font size to increase or decrease in size?
I like to have the fonts of the header to to larger than the other fonts.

does anyone know how to achieve this?

Thanks

Desi

Is This A Good Question/Topic? 0

  • +

#2 Curtis Rutland User is offline

Reputation: 5106

  • View blog
  • Posts: 9,283
  • Joined: 08-June 10

Re: Console Application Font Size

Posted 25 October 2010 - 04:37 AM

As far as I'm aware, you can't do this programatically. There are registry keys that you could change to set font style and size, but it wouldn't be a line-by-line change.

However, you can change the background and text colors:

Console.ForegroundColor = ConsoleColor.Blue; Console.BackgroundColor = ConsoleColor.Yellow;            

That might help.

#3 [email protected] User is offline

Reputation: 1003

  • View blog
  • Posts: 975
  • Joined: 30-September 10

Re: Console Application Font Size

Posted 25 October 2010 - 04:37 AM

Hello there,

I am pretty sure there are not any properties in c# to change the font size in the console window. I think the only real text related thing you can change is the colour of the text.

#4 bravo659 User is offline

  • D.I.C Head

Reputation: -3

  • View blog
  • Posts: 181
  • Joined: 18-May 08

Re: Console Application Font Size

Posted 25 October 2010 - 04:44 AM

View PostinsertAlias, on 25 October 2010 - 03:37 AM, said:

As far as I'm aware, you can't do this programatically. There are registry keys that you could change to set font style and size, but it wouldn't be a line-by-line change.

However, you can change the background and text colors:

Console.ForegroundColor = ConsoleColor.Blue; Console.BackgroundColor = ConsoleColor.Yellow;              

That might help.

Yes the font and background i got is not a problem just was looking for the changing of the fonts and style.
Guess not lol thanks.

View Post[email protected], on 25 October 2010 - 03:37 AM, said:

Hello there,

I am pretty sure there are not any properties in c# to change the font size in the console window. I think the only real text related thing you can change is the colour of the text.

I did looked around to see if I find something on it but it mentioned the same thing cant be done. I guess the drafters of the console app forgot this part. LOL thanks anyway.

#5 baavgai User is offline

Reputation: 7507

  • View blog
  • Posts: 15,558
  • Joined: 16-October 07

Re: Console Application Font Size

Posted 25 October 2010 - 04:51 AM

View Postbravo659, on 25 October 2010 - 05:26 AM, said:

Is there a possibility of having a console application font size to increase or decrease in size?

No. The font settings belong to the OS.

Then again, if you care about formatting, why the hell are you using the console?

#6 bravo659 User is offline

  • D.I.C Head

Reputation: -3

  • View blog
  • Posts: 181
  • Joined: 18-May 08

Re: Console Application Font Size

Posted 25 October 2010 - 07:22 AM

View Postbaavgai, on 25 October 2010 - 03:51 AM, said:

View Postbravo659, on 25 October 2010 - 05:26 AM, said:

Is there a possibility of having a console application font size to increase or decrease in size?

No. The font settings belong to the OS.

Then again, if you care about formatting, why the hell are you using the console?

Because if you can do it with color, why the hell it cant be done changing font size?

The reason im asking is wondering if it can be done. I am in the advanced C# class and like to know thats is all.
How many years of experience do you have in C#? If i may ask.

Thanks.
Desi

This post has been edited by bravo659: 25 October 2010 - 07:23 AM

Was This Post Helpful? -1

#7 Curtis Rutland User is offline

Reputation: 5106

  • View blog
  • Posts: 9,283
  • Joined: 08-June 10

Re: Console Application Font Size

Posted 25 October 2010 - 07:48 AM

I can't speak for baavgai (though my guess would be "a lot"), but I have personally been working professionally with C# for about four years now.

As to the reasoning, you'd have to go back and ask the creators of cmd.exe why they provided methods to change colors but not sizes.

My guess is because consoles are totally monospace. To have one line larger than the other completely kills that. Consoles (going back to DOS and before) have always had a fixed number of characters across and down (and the older ones had fixed resolutions too). Changing the font size would have blown those proportions.

Color doesn't change any position. Size would. This is why you can globally change this (via registry or some obscure setting somewhere) but not line-by-line or programatically change it.

This post has been edited by insertAlias: 25 October 2010 - 07:49 AM

#8 baavgai User is offline

Reputation: 7507

  • View blog
  • Posts: 15,558
  • Joined: 16-October 07

Re: Console Application Font Size

Posted 25 October 2010 - 08:59 AM

View Postbravo659, on 25 October 2010 - 08:22 AM, said:

How many years of experience do you have in C#?

Hmm... When did .NET come out? I think we started using it before .NET 1.1, so reckon from the beginning minus maybe six months? You can do the math.

The point is, the minute you're on a Windows machine and start messing about with Console as a user interface option, you've kind of failed at Windows. Windows offers a consistent UI with familiar controls to interact with the user. A console is useful for display agnostic text streams. Of for reliving the DOS glory days, I guess.

Now, it's possible to mess with a console, outside of C#'s managed environment. I just think it's rather pointless.

You'd need to figure out the process that your console is running under, get a handle, can call a Win32 DLL. You'd probably use SetCurrentConsoleFontEx. All very messy, but possible.

#9 tlhIn`toq User is offline

Reputation: 6538

  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: Console Application Font Size

Posted 25 October 2010 - 09:31 AM

Quote

I am in the advanced C# class

... And everything they're teaching you is still in console???

How many courses do you have to take until they let you work in a GUI Windows.Form?

#10 bravo659 User is offline

  • D.I.C Head

Reputation: -3

  • View blog
  • Posts: 181
  • Joined: 18-May 08

Re: Console Application Font Size

Posted 28 October 2010 - 08:27 PM

View PosttlhIn, on 25 October 2010 - 08:31 AM, said:

Quote

I am in the advanced C# class

... And everything they're teaching you is still in console???

How many courses do you have to take until they let you work in a GUI Windows.Form?

Especially in Java and C# is all in console.
I agree with all of you guys who posted on this question.
I did changed the color and the console windows size as well.
The professor wanted us to spice up the console app.
This is what I could only do.

Console.WindowWidth = (Console.LargestWindowWidth * 6 / 10); Console.WindowHeight = (Console.LargestWindowHeight * 8 / 10);            

View PosttlhIn, on 25 October 2010 - 08:31 AM, said:

Quote

I am in the advanced C# class

... And everything they're teaching you is still in console???

How many courses do you have to take until they let you work in a GUI Windows.Form?

We are also doing the gui windows form as well.
They are also taking the same textbook and from their divide the intro, intermediate class.
For the advanced class we receive a new textbook but then we have to read two to three chapters every week then we continue to write console apps a like three chapters on gui apps. Java is the same way.

Attached image(s)

  • Attached Image

#11 Robin19 User is offline

Reputation: 272

  • View blog
  • Posts: 552
  • Joined: 07-July 10

Re: Console Application Font Size

Posted 29 October 2010 - 07:47 AM

My Java class just glossed over the GUI part. They figure if you can write good code using just the console, you won't have a problem writing code using a WYSIWYG environment.

#12 Curtis Rutland User is offline

Reputation: 5106

  • View blog
  • Posts: 9,283
  • Joined: 08-June 10

Re: Console Application Font Size

Posted 29 October 2010 - 08:07 AM

All the java classes I took didn't care about the GUI part, because that wasn't what they were trying to teach. They really weren't even trying to teach Java so much as they were trying to teach Object Oriented Programming principles that can apply to any language.

#13 AdamSpeight2008 User is offline

Reputation: 2298

  • View blog
  • Posts: 9,535
  • Joined: 29-May 08

Re: Console Application Font Size

Posted 29 October 2010 - 06:26 PM

Console Applications lets you focus on the core of the language, without the does it look pretty.
The GUI leads to the thinking I must use a control for everything.

#14 baavgai User is offline

Reputation: 7507

  • View blog
  • Posts: 15,558
  • Joined: 16-October 07

Re: Console Application Font Size

Posted 29 October 2010 - 08:13 PM

Agreed.

Learning the basics without the distraction of GUI widgets, I think, is easier. The student might be thinking "but no one writes console apps any more" and they'd be right. Particularly in Windows. However, the real meat of a program isn't the UI. If you can write a good clean console app, putting a shiny forms finish on it should be trivial. Conversely, using a forms designer really isn't programming.

Also, answering forms based questions is needlessly complex. You get bogged down in the details of the display, rather than the heart of the code.

Enjoy your plain vanilla console while you can. You'll miss it. And you'll return to it for quick and dirty prototyping; happy that you don't have to be bother by all the visual user details that a real program usually entails.

#15 bravo659 User is offline

  • D.I.C Head

Reputation: -3

  • View blog
  • Posts: 181
  • Joined: 18-May 08

Re: Console Application Font Size

Posted 31 October 2010 - 08:09 PM

Hi yes i agree with you. Is not real programming is using the forms designer.
years ago I was learning how to program in COBOL and this was back in the late 1976 or 1977. I forgot all the code and maybe just the five divisions i may remember. But the code was not trivial but real programming assembler code. I should had continued it as a career and now learning how to program again is not such of a real DOS coding except in the console app which is minimal to the DOS. I do appreciate for your guys help with my assignments. this is a career change from the construction trades. I hope I can be successful in my programming adventure.

How to Change Font Size in C# Console Application

Source: https://www.dreamincode.net/forums/topic/196637-console-application-font-size/

0 Response to "How to Change Font Size in C# Console Application"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel