IXpsOMSolidColorBrush::SetColor method (xpsobjectmodel.h)

Sets the color value and color profile of the brush.

Syntax

HRESULT SetColor(
  [in] const XPS_COLOR            *color,
  [in] IXpsOMColorProfileResource *colorProfile
);

Parameters

[in] color

The color value of the brush.

If the value of the colorType field in the XPS_COLOR structure that is passed in this parameter is XPS_COLOR_TYPE_CONTEXT, a valid color profile must be provided in the colorProfile parameter.

[in] colorProfile

The color profile to be used with color.

A color profile is required when the value of the colorType field in the XPS_COLOR structure that is passed in the color parameter is XPS_COLOR_TYPE_CONTEXT. If the value of the colorType field is not XPS_COLOR_TYPE_CONTEXT, this parameter must be set to NULL.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the table that follows. For information about XPS document API return values that are not listed in this table, see XPS Document Errors.

Return code Description
S_OK
The method succeeded.
E_POINTER
color is NULL.
XPS_E_MISSING_COLORPROFILE
colorProfile is NULL when a color profile is expected. A color profile is required when the color type is XPS_COLOR_TYPE_CONTEXT.
XPS_E_UNEXPECTED_COLORPROFILE
colorProfile has a color profile when none is expected. A color profile is only allowed when the color type is XPS_COLOR_TYPE_CONTEXT.
XPS_E_NO_CUSTOM_OBJECTS
colorProfile does not point to a recognized interface implementation. Custom implementation of XPS Document API interfaces is not supported.

Requirements

Requirement Value
Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header xpsobjectmodel.h

See also

IXpsOMColorProfileResource

IXpsOMSolidColorBrush

XML Paper Specification

XPS Document Errors

XPS_COLOR