2014-05-21 61 views
-1

我想在RichTextBox sp。中更改字體樣式。 我在WPF工作。將字體樣式更改爲richtextbox

sp.FontStyle = FontStyle.Bold; 

錯誤說:System.Windows.FontStyle' does not contain a definition for 'Bold' 我不知道,怎麼改,如果開工。

回答

1

您需要在fontWeight設置 - 屬性設置粗體:

sp.Font = new Font(sp.Font.Name, sp.Font.Size, FontStyle.Bold); 
:在的WinForms

sp.FontWeight = FontWeights.Bold;