【发布时间】:2012-04-27 17:24:18
【问题描述】:
这是使用 C# 更改字体大小的最简单方法。
在 java 中,这一切都可以通过调用带有必要参数的 Font 构造函数来轻松完成。
JLabel lab = new JLabel("Font Bold at 24");
lab.setFont(new Font("Serif", Font.BOLD, 24));
【问题讨论】:
这是使用 C# 更改字体大小的最简单方法。
在 java 中,这一切都可以通过调用带有必要参数的 Font 构造函数来轻松完成。
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)
参考here
【讨论】:
使用这个只改变字体大小而不是字体名称
label1.Font = new System.Drawing.Font(label1.Font.Name, 24F);
【讨论】:
使用Font Class 设置控件的字体和样式。
试试Font Constructor (String, Single)
Label lab = new Label();
lab.Text ="Font Bold at 24";
lab.Font = new Font("Arial", 20);
或
lab.Font = new Font(FontFamily.GenericSansSerif,
12.0F, FontStyle.Bold);
要安装字体,请参考 - .NET System.Drawing.Font - Get Available Sizes and Styles
【讨论】:
应该这样做(粗体);
label1.Font = new Font("Serif", 24,FontStyle.Bold);
【讨论】:
您还可以创建一个变量,然后将其分配给文本。这很酷,因为您可以为其分配两个或更多文本。
要分配一个变量这样做
public partial class Sayfa1 : Form
Font Normal = new Font("Segoe UI", 9, FontStyle.Bold);
public Sayfa1()
此变量尚未分配给任何文本。为此,请写入文本的名称(查看比例 ->(名称)),然后写入“.Font”,然后调用您的字体变量的名称。
lupusToolStripMenuItem.Font = Normal;
现在您有一个分配给普通字体的文本。我希望我能有所帮助。
【讨论】:
您可以使用属性面板中的标签属性来更改它。 This screen shot is example that
【讨论】: