I'am doing this:
//Find text to replace
int Pos = stcDoc.Find(ToFind, 0, FindOptions.NoMessageBox);
// If no match return, else select it.
if (Pos < 0) return;
stcDoc.Select(Pos, ToFind.Length);
// Get Font name and size.
string fName = stcDoc.Selection.FontName;
int fSize = stcDoc.Selection.FontSize;
// Replace selection (text found) with string containg Rich Text.
stcDoc.Selection.Load(rtfText, StringStreamType.RichTextFormat);
// Asign foun text Font name and size to replaced content.
stcDoc.Selection.FontName = fName;
stcDoc.Selection.FontSize = fSize;
Last two lines has no effect, but has effect for PlaintText.
//Find text to replace
int Pos = stcDoc.Find(ToFind, 0, FindOptions.NoMessageBox);
// If no match return, else select it.
if (Pos < 0) return;
stcDoc.Select(Pos, ToFind.Length);
// Get Font name and size.
string fName = stcDoc.Selection.FontName;
int fSize = stcDoc.Selection.FontSize;
// Replace selection (text found) with string containg Rich Text.
stcDoc.Selection.Load(rtfText, StringStreamType.RichTextFormat);
// Asign foun text Font name and size to replaced content.
stcDoc.Selection.FontName = fName;
stcDoc.Selection.FontSize = fSize;
Last two lines has no effect, but has effect for PlaintText.