Easiest way to change font and font size

后端 未结 6 1638
迷失自我
迷失自我 2020-12-02 17:01

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.

JLab         


        
6条回答
  •  一个人的身影
    2020-12-02 17:18

    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

提交回复
热议问题