Easiest way to change font and font size

后端 未结 6 1639
迷失自我
迷失自我 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:21

    Use the Font Class to set the control's font and styles.

    Try Font Constructor (String, Single)

    Label lab  = new Label();
    lab.Text ="Font Bold at 24";
    lab.Font = new Font("Arial", 20);
    

    or

    lab.Font = new Font(FontFamily.GenericSansSerif,
                12.0F, FontStyle.Bold);
    

    To get installed fonts refer this - .NET System.Drawing.Font - Get Available Sizes and Styles

提交回复
热议问题