// Get the current text selection or to text entered after the insertion point.
// Build new font based on the selection font, make it both Bold and Underline
// Apply new font to currently selected text (or for new text at insertion point
Font currFont = richTextBox.SelectionFont;
Font boldUnderFont = new Font(currFont, FontStyle.Bold | FontStyle.Underline);
richTextBox.SelectionFont = boldUnderFont;
2 回答
我不得不像你必须那样思考 . 我觉得这是一个老帖子 . 但是,对于那些可能遇到同样问题的人 . 您不能将字体样式,字体系列,...应用于字符串,除非您逐个字符地迭代,因此您可以获得SelectionFont . 这是可以帮助您的方法:
有关如何创建自定义richtexBox控件的更多详细信息,请转到http://how-to-code-net.blogspot.ro/2014/01/how-to-make-custom-richtextbox-control.html
除非我完全误解了这个问题