Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easiest way to change font and font size

Tags:

c#

winforms

fonts

which is the easiest way to change Font size with C#.

with java it can all be done easily by calling Font constructor with necessary arguments.

JLabel lab  = new JLabel("Font Bold at 24"); lab.setFont(new Font("Serif", Font.BOLD, 24)); 
like image 916
Arianule Avatar asked Apr 16 '12 11:04

Arianule


People also ask

How do you change font size quickly?

Keyboard shortcutHold down the Ctrl and press the + to increase the font size or - to decrease the font size. Pressing either of these keys while continuing to hold down the control key continues to increase or decrease the font until it reaches its maximum.

How do I change the font and font size?

To change the font size of selected text in desktop Excel, PowerPoint, or Word: Select the text or cells with text you want to change. To select all text in a Word document, press Ctrl + A. On the Home tab, click the font size in the Font Size box.

What are two ways to change the font size?

To make the texts larger, press “Ctrl + ]”. To make the texts smaller, press “Ctrl + [”.

How do I change the font from small to large font?

To change your display in Windows, select Start > Settings > Accessibility > Text size. To make only the text on your screen larger, adjust the slider next to Text size. To make everything larger, including images and apps, select Display , and then choose an option from the drop-down menu next to Scale.


1 Answers

Maybe something like this:

yourformName.YourLabel.Font = new Font("Arial", 24,FontStyle.Bold); 

Or if you are in the same class as the form then simply do this:

YourLabel.Font = new Font("Arial", 24,FontStyle.Bold); 

The constructor takes diffrent parameters (so pick your poison). Like this:

Font(Font, FontStyle)    Font(FontFamily, Single) Font(String, Single) Font(FontFamily, Single, FontStyle) Font(FontFamily, Single, GraphicsUnit) Font(String, Single, FontStyle) Font(String, Single, GraphicsUnit) Font(FontFamily, Single, FontStyle, GraphicsUnit) Font(String, Single, FontStyle, GraphicsUnit) Font(FontFamily, Single, FontStyle, GraphicsUnit, Byte) Font(String, Single, FontStyle, GraphicsUnit, Byte) Font(FontFamily, Single, FontStyle, GraphicsUnit, Byte, Boolean) Font(String, Single, FontStyle, GraphicsUnit, Byte, Boolean) 

Reference here

like image 150
Arion Avatar answered Oct 04 '22 00:10

Arion