我确定如果对以下对象执行AND运算符:
FontStyle fontStyle;
fontStyle = FontStyle.Bold & FontStyle.Italic
生成的FontStyle将为粗体斜体,但令我惊讶的是,生成的FontStyle为:FontStyle.Regular
。
请说明以编程方式将FontStyle设置为Bold Italic的方法。
我使用的是FontFamily:New Times Roman。
谢谢。
答案 0 :(得分:3)
使用“或”运算符将两者都应用。
fontstyle = FontStyle.Bold | FontStyle.Italic