次の方法で共有


IXRTextElement::GetForeground (Compact 2013)

3/28/2014

This method retrieves the brush that paints the text in this text element.

Syntax

virtual HRESULT STDMETHODCALLTYPE GetForeground(
    __out IXRBrush** ppForeground
) = 0;

Parameters

  • ppForeground
    [out] Address of a pointer to an object derived from IXRBrush that paints the text in the text element.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

The value of ppForeground specifies the brush for the displayed text. A brush can represent a solid color, a linear or radial gradient, or an image.

When you animate the foreground text, you must use indirect targeting syntax. For example, to animate the color of a SolidColorBrush control that is the foreground of a TextBlock control, you could use the following:

<ColorAnimation ... Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" />.

For more information about how to set the foreground brush in XAML, see the Microsoft Silverlight 3 documentation.

To use a specific interface pointer type, you can use the helper template version of this method that XAML for Windows Embedded provides. When you supply a derived type, this version automatically supplies a type-safe method that implicitly converts the returned type from a generic interface, so you do not have to explicitly call QueryInterface to convert the generic interface into the required object type.

.NET Framework Equivalent

System.Windows.Documents.TextElement.Foreground

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRTextElement
IXRTextElement::SetForeground