我想在RichTextBox sp中更改字体样式。 我在WPF工作。
sp.FontStyle = FontStyle.Bold;
错误说:System.Windows.FontStyle' does not contain a definition for 'Bold'
我不知道,如果开始工作,如何改变。
答案 0 :(得分:1)
您需要在 FontWeight -property:
中设置粗体sp.FontWeight = FontWeights.Bold;
在WinForms中相同:
sp.Font = new Font(sp.Font.Name, sp.Font.Size, FontStyle.Bold);