Edit

Share via


ITextFont::SetForeColor method (tom.h)

Sets the foreground (text) color.

Syntax

HRESULT SetForeColor(
  [in] long Value
);

Parameters

[in] Value

Type: long

The new foreground color. It can be one of the following.

Value Meaning
A COLORREF value. An RGB color.
A value returned by PALETTEINDEX A palette index.
tomUndefined No change.
tomAutoColor Use the default foreground color.
 

If Value contains an RGB color, generate the COLORREF by using the RGB macro.

Return value

Type: HRESULT

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes. For more information about COM error codes, see Error Handling in COM.

Return code Description
E_INVALIDARG
Invalid argument.
CO_E_RELEASED
The font object is attached to a range that has been deleted.
E_ACCESSDENIED
Write access is denied.
E_OUTOFMEMORY
Insufficient memory.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header tom.h
DLL Msftedit.dll

See also

COLORREF

Conceptual

GetForeColor

ITextFont

Other Resources

PALETTEINDEX

RGB

Reference

Text Object Model