c# - How to make richtextbox change the font property for non-selected text like in wordpad? -


i have been working in creating text-editor.

using rtbeditor.selection... can change selected text properties.

but in wordpad when don't selected text change properties of text type in.

here sample code shows how using previewtextinput event:

private void rtb_textinput(object sender, textcompositioneventargs e)   {      textpointer textpointer = rtb.caretposition.getinsertionposition(logicaldirection.forward);      run run = new run(e.text, textpointer);      run.fontsize = selectedfontsize;      run.fontfamily = selectedfontfamily;      rtb.caretposition = run.elementend;   } 

Comments