如何将多种字体样式应用于文本?
System.Drawing.Font MyFont = new System.Drawing.Font(
thisTempLabel.LabelFont,
((float)thisTempLabel.fontSize),
FontStyle.Bold + FontStyle.Italic, // + obviously doesn't work, but what am I meant to do?
GraphicsUnit.Pixel
);
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助!
usr*_*ΛΩΝ 46
System.Drawing.Font MyFont = new System.Drawing.Font(
thisTempLabel.LabelFont,
((float)thisTempLabel.fontSize),
FontStyle.Bold | FontStyle.Italic, // + obviously doesn't work, but what am I meant to do?
GraphicsUnit.Pixel
);
Run Code Online (Sandbox Code Playgroud)
也许你想使用OR运算符(|)
ano*_*ery 10
FontStyle 是一个标志枚举,因此您可以通过以下方式设置多个样式:
FontStyle.Bold | FontStyle.Italic
Run Code Online (Sandbox Code Playgroud)
我认为这是 FontStyle.Bold | 字体样式.斜体
您通常使用管道(按位或)符号来组合这些函数中的多个标志
这一页解释了它
http://www.blackwasp.co.uk/CSharpLogicalBitwiseOps_2.aspx
| 归档时间: |
|
| 查看次数: |
85515 次 |
| 最近记录: |