Change color and font for some part of text in WPF C#

后端 未结 4 1110
孤城傲影
孤城傲影 2020-11-27 18:25

Is there a way to change color and font for some part of text which I want to put on TextBox or RichTextBox. I am using C# WPF.

For example

 richText         


        
4条回答
  •  囚心锁ツ
    2020-11-27 18:52

    You need to use the Document property of RichTextBox and add a Run to it.

    Document property: http://msdn.microsoft.com/en-us/library/system.windows.controls.richtextbox.document.aspx
    Run: http://msdn.microsoft.com/en-us/library/system.windows.documents.run.aspx

提交回复
热议问题