سؤال

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.

هل كانت مفيدة؟

المحلول

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);

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top