![](/img/trans.png)
[英]How can I increase the FontSize of a text with an ComboBox, but just the selected part of the Text?
[英]How do I Increase Fontsize for text in richtextbox
如何在每次調用方法時設置字體大小。我想使用richtextbox.ApplyPropertyValue()
方法。 我已經試過了
myrichtextbox.SetValue(TextElement.FontSizeProperty, fontSizedouble +10);
myrichtextbox.FontSize = (myrichtextbox.FontSize + 10);
對於富文本框,您需要選擇 -
試試這個
TextSelection selectedText = myrichtextbox.Selection;
selectedText.ApplyPropertyValue(RichTextBox.FontSizeProperty, fontSizedouble +10);
對於所有文本,你可以嘗試這個 -
TextRange allText = new TextRange(MyRichTextBox.Document.ContentStart, MyRichTextBox.Document.ContentEnd);
allText.ApplyPropertyValue(RichTextBox.FontSizeProperty, fontSizedouble +10);
要一次又一次地改變大小,你需要檢查文本的大小而不是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.