How to Set the Font to Arial in C#
C#, or C sharp, is a programming language developed by Microsoft. It is an object-oriented programming language that is designed to be a Common Language Infrastructure, or a programing language that can be used on many different platforms. When programming in C#, you can set the system to use any font that is available on the local computer's operating system. Since all Windows computers contain the Arial font, a single line of code is all that it takes to set a C# program to display characters in Arial.
Instructions
-
-
1
Open the programming shell that you use to write your C# programs.
-
2
Open the C# program file in which you wish to implement the Arial font.
-
-
3
Type the following line of code in the main body of your program:
Font a = new Font("Arial", 16, FontStyle.Regular);
The code will define the font "a" as Arial with a font size of 16. If you want to change the font to a different size, simply input a size other than 16. If you want to change the font style, you can set it FontStyle.Bold, FontStyle.Italics, or FontStyle.Underline.
-
4
Specify the font as "a" within any output command within your program in which you want the output text to be displayed in Arial.
For instance, to display the text "Hello World" in Arial font, you would type the line:
Console.Writeline(a, "Hello World");
-
1