Back to Devexpress

CharacterPropertiesBase.ForeColor Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-characterpropertiesbase-d85a6405.md

latest6.3 KB
Original Source

CharacterPropertiesBase.ForeColor Property

Gets or sets the foreground color of characters.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
Color? ForeColor { get; set; }
vb
Property ForeColor As Color?

Property Value

TypeDescription
Nullable<Color>

A Color value representing the foreground color, or null for a mixture of values.

|

Remarks

Use the CharacterProperties interface to change character formatting.

If the CharacterPropertiesBase.ForeColor is not set explicitly, the AppearanceObject.ForeColor property value is in effect. Modification of the ForeColor applies changes to the CharacterPropertiesBase.ForeColor property of characters with an unspecified foreground color.

Important

The semi-transparent alpha component (i.e. the Color’s alpha parameter set to value less than 255) is reset to opaque (255) during rendering and export.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ForeColor property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Styles.cs#L22

csharp
cstyle.Parent = document.CharacterStyles["Default Paragraph Font"];
cstyle.ForeColor = System.Drawing.Color.DarkOrange;
cstyle.Strikeout = StrikeoutType.Double;

wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/FormattingActions.cs#L19

csharp
cp.FontSize = 18;
cp.ForeColor = Color.Blue;
cp.BackColor = Color.Snow;

word-document-api-examples/CS/CodeExamples/StylesActions.cs#L36

csharp
cstyle.Parent = document.CharacterStyles["Default Paragraph Font"];
cstyle.ForeColor = System.Drawing.Color.DarkOrange;
cstyle.Strikeout = StrikeoutType.Double;

winforms-rich-edit-text-formatting/CS/Text Formatting Example/Form1.cs#L53

csharp
titleFormatting.FontName = "Helvetica";
titleFormatting.ForeColor = Color.DarkBlue;

winforms-richedit-table-of-contents-practical-guide/CS/Form1.cs#L96

csharp
cp.FontSize = 12;
cp.ForeColor = Color.Blue;
Document.EndUpdateCharacters(cp);

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Styles.vb#L20

vb
cstyle.Parent = document.CharacterStyles("Default Paragraph Font")
cstyle.ForeColor = System.Drawing.Color.DarkOrange
cstyle.Strikeout = DevExpress.XtraRichEdit.API.Native.StrikeoutType.[Double]

wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/FormattingActions.vb#L16

vb
cp.FontSize = 18
cp.ForeColor = Color.Blue
cp.BackColor = Color.Snow

word-document-api-examples/VB/CodeExamples/StylesActions.vb#L33

vb
cstyle.Parent = document.CharacterStyles("Default Paragraph Font")
cstyle.ForeColor = System.Drawing.Color.DarkOrange
cstyle.Strikeout = DevExpress.XtraRichEdit.API.Native.StrikeoutType.[Double]

winforms-rich-edit-text-formatting/VB/Text Formatting Example/Form1.vb#L50

vb
titleFormatting.FontName = "Helvetica"
titleFormatting.ForeColor = Color.DarkBlue

winforms-richedit-table-of-contents-practical-guide/VB/Form1.vb#L88

vb
cp.FontSize = 12
cp.ForeColor = Color.Blue
Document.EndUpdateCharacters(cp)

See Also

ShowFontFormCommand

CharacterPropertiesBase Interface

CharacterPropertiesBase Members

DevExpress.XtraRichEdit.API.Native Namespace