[英]How do I Increase Fontsize for text in richtextbox
How to set font size in each time i call a method.i want to use richtextbox.ApplyPropertyValue()
method. 如何在每次调用方法时设置字体大小。我想使用
richtextbox.ApplyPropertyValue()
方法。 I already tried 我已经试过了
myrichtextbox.SetValue(TextElement.FontSizeProperty, fontSizedouble +10);
myrichtextbox.FontSize = (myrichtextbox.FontSize + 10);
For rich text box you need selection-- 对于富文本框,您需要选择 -
try this 试试这个
TextSelection selectedText = myrichtextbox.Selection;
selectedText.ApplyPropertyValue(RichTextBox.FontSizeProperty, fontSizedouble +10);
For all text you can try this -- 对于所有文本,你可以尝试这个 -
TextRange allText = new TextRange(MyRichTextBox.Document.ContentStart, MyRichTextBox.Document.ContentEnd);
allText.ApplyPropertyValue(RichTextBox.FontSizeProperty, fontSizedouble +10);
And to change size again and again you need to check size for text not richTextBox, do this -- 要一次又一次地改变大小,你需要检查文本的大小而不是richTextBox,这样做 -
TextRange allTextRange = new TextRange(MyRichTextBox.Document.ContentStart, MyRichTextBox.Document.ContentEnd);
var size = (double)allTextRange.GetPropertyValue(FontSizeProperty);
allTextRange.ApplyPropertyValue(RichTextBox.FontSizeProperty, size + 10);
从FlowDocument
更改它。
this.Document.FontSize = this.Document.FontSize + 10;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.