Skip to main content

CharacterPropertiesBase Interface

Serves as the base for the CharacterProperties interface providing access to character properties.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v14.2.Core.dll

#Declaration

[ComVisible(true)]
public interface CharacterPropertiesBase

#Returned By

Properties that return CharacterPropertiesBase instances:

#Remarks

The CharacterPropertiesBase interface allows you to get/set character formatting.

Use the SubDocument.BeginUpdateCharacters and the SubDocument.EndUpdateCharacters paired methods to modify character formatting, such as the CharacterPropertiesBase.FontName, CharacterPropertiesBase.FontSize, CharacterPropertiesBase.Bold, CharacterPropertiesBase.ForeColor etc.

To accomplish this, call the SubDocument.BeginUpdateCharacters method for the specified range, modify the properties of the returned CharacterProperties object, and call the SubDocument.EndUpdateCharacters method to finalize the modification.

NOTE

Make sure that the SubDocument.BeginUpdateCharacters method always has its corresponding SubDocument.EndUpdateCharacters method to ensure proper operation of the control.

The following code snippet changes the font and the color of the selected text.

using DevExpress.XtraRichEdit.API.Native;
// ...
    Document doc = richEditControl1.Document;
    CharacterProperties charProperties = doc.BeginUpdateCharacters(doc.Selection);
    charProperties.FontName = "Arial";
    charProperties.FontSize = 16;
    charProperties.ForeColor = Colors.Red;
    charProperties.Bold = true;
    doc.EndUpdateCharacters(charProperties);
See Also