Freigeben über


textColor property

Sets or retrieves the color of the text in the object.

Syntax

HRESULT value = object.put_textColor(VARIANT v);HRESULT value = object.get_textColor(VARIANT* p);

Property values

Type: VARIANT

One of the values in the Property Values section.

Remarks

There is only a difference between the transparent and undefined values when there are multiple style properties that apply to a single run of text. In this situation, the IHTMLRenderStyle::renderingPriority property determines which colors are applied. An undefined value does not participate in text color determination, regardless of its priority. A transparent value only has an effect if it has the highest priority value—that is, if it is the text color value that is ultimately applied to the given text run.

For instance, consider a style1, with priority 1, which specifies red. Then consider a style2, with priority 2, which specifies undefined. If both styles are applied to the same run of text, red is ultimately used as the text color because style2, even though it has a higher priority, is undefined and therefore has no effect.

Now consider a style3, with priority 2, which specifies transparent. If both style1 (defined in the previous paragraph) and style3 are applied to the same run of text, no additional color is applied because style3 has a higher priority, so transparent is applied instead of red. Of course, if color was applied via CSS, that color will appear.