0

I want to change some part of text in richEditControl Devexpress.

For Example this sentence.

"Kocaeli University Computer Engineering Department"

when i click a button this may can change that one.

"Kocaeli University Computer Engineering Department"

only some part of text can be Italic or other appearance.

thanks.

TheMuyu
  • 579
  • 2
  • 12
  • 31

2 Answers2

2

Example below shows how you can change selected texts italic property:

//Gets selected text range
DocumentRange range = richEditControl1.Document.Selection;
//Begin selected text update
CharacterProperties characterProperties = richEditControl1.Document.BeginUpdateCharacters(range);
//Change font
characterProperties.Italic = true;
//End update
richEditControl1.Document.EndUpdateCharacters(characterProperties);
Renatas M.
  • 11,694
  • 1
  • 43
  • 62
0

i try to this.

DocumentRange[] dr = richEditControl1.Document.FindAll("Computer Engineering", SearchOptions.None);
CharacterProperties cp = richEditControl1.Document.BeginUpdateCharacters(dr[0]);
cp.Italic = true;
richEditControl1.Document.EndUpdateCharacters(cp);

everything is good until when i change the text in richtextcontrol if i add only a letter or char in text that appearance "italic" is changed.

for example when i changed Computer Engineer to italic and add one letter or char to textcontrol the italic is go away.

TheMuyu
  • 579
  • 2
  • 12
  • 31