您究竟如何更改 RichTextBox 中的字体?
环顾四周给了我似乎不再起作用的旧答案。我认为这就像做richtextbox1.Font = Font.Bold;
或类似的事情一样简单。原来不是,所以我环顾四周。显然您必须更改FontStyle
which is a readonly
(??) 属性,但您必须创建一个新FontStyle
对象。
但即使那样也行不通
你怎么做到这一点?编辑:
似乎不起作用:\
rssTextBox.Document.Blocks.Clear();
rssTextBox.FontWeight = FontWeights.Bold;
rssTextBox.AppendText("Title: ");
rssTextBox.FontWeight = FontWeights.Normal;
rssTextBox.AppendText(rs.Title + "\n");
rssTextBox.FontWeight = FontWeights.Bold;
rssTextBox.AppendText("Publication Date: ");
rssTextBox.FontWeight = FontWeights.Normal;
rssTextBox.AppendText(rs.PublicationDate + "\n");
rssTextBox.FontWeight = FontWeights.Bold;
rssTextBox.AppendText("Description: ");
rssTextBox.FontWeight = FontWeights.Normal;
rssTextBox.AppendText(rs.Description + "\n\n");