C# 更改字体和字号的最简单方法

C# 更改字体和字号的最简单方法,c#,winforms,fonts,C#,Winforms,Fonts,使用C#更改字体大小的最简单方法是什么 使用java,通过调用带有必要参数的字体构造函数,可以轻松地完成这一切 JLabel lab = new JLabel("Font Bold at 24"); lab.setFont(new Font("Serif", Font.BOLD, 24)); 也许是这样的: yourformName.YourLabel.Font = new Font("Arial", 24,FontStyle.Bold); 或者,如果您与表单属于同一类,则只需执行以下操作

使用C#更改字体大小的最简单方法是什么

使用java,通过调用带有必要参数的字体构造函数,可以轻松地完成这一切

JLabel lab  = new JLabel("Font Bold at 24");
lab.setFont(new Font("Serif", Font.BOLD, 24));

也许是这样的:

yourformName.YourLabel.Font = new Font("Arial", 24,FontStyle.Bold);
或者,如果您与表单属于同一类,则只需执行以下操作:

YourLabel.Font = new Font("Arial", 24,FontStyle.Bold);
构造函数接受不同的参数(所以选择你的毒药)。像这样:

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)
参考

这应该可以做到(也可以用粗体)

使用设置控件的字体和样式

试一试


要安装字体,请参阅此-

使用此选项仅更改字体大小,而不更改字体名称

label1.Font = new System.Drawing.Font(label1.Font.Name, 24F);

也可以创建变量,然后将其指定给文本。它很酷,因为你可以给它分配两个或更多的文本

要分配变量,请执行该操作

public partial class Sayfa1 : Form

   Font Normal = new Font("Segoe UI", 9, FontStyle.Bold);

    public Sayfa1()
此变量尚未分配给任何文本。若要执行此操作,请写入文本名称(Look proporties->(name)),然后写入“.Font”,然后调用字体变量的名称

lupusToolStripMenuItem.Font = Normal;

现在,您已将文本指定给普通字体。希望能对您有所帮助。

您可以使用“属性面板”中的“标签”属性更改该属性。

好久不说话了-但是您没有处理旧字体-如果您经常这样做-您可能会用完GDI句柄。我说得对吗?
label1.Font = new System.Drawing.Font(label1.Font.Name, 24F);
public partial class Sayfa1 : Form

   Font Normal = new Font("Segoe UI", 9, FontStyle.Bold);

    public Sayfa1()
lupusToolStripMenuItem.Font = Normal;