Share via


IXRUIElement::SetUseLayoutRounding (Compact 2013)

3/28/2014

This method sets a value that determines whether rendering for the object and its visual subtree use rounding behavior that aligns rendering to whole pixels.

Syntax

virtual HRESULT STDMETHODCALLTYPE SetUseLayoutRounding(
    __in bool UseLayoutRounding
) = 0;

Parameters

  • UseLayoutRounding
    [in] ] Sets whether rendering for the object and its visual subtree use rounding behavior that aligns rendering to whole pixels. If this value is set to true, rendering and layout use layout rounding to whole pixels. The default value is true.

Return Value

Returns an HRESULT that indicates whether or not the method succeeded..

Remarks

The default of true causes measurement and layout operations to round potential subpixel values and render objects aligned to pixel boundaries. This behavior is intended to reduce the visual artifacts that can be perceived when a subpixel value renders and affects pixels on either side of the subpixel boundary. The most prominent example of such an artifact is when you intend to produce a crisp, thin line of a particular color. If your line measurement gave a subpixel value, and the layout behavior did not round to whole pixels, the line can appear blurry and in a dimmer color shade than you intended.

Setting UseLayoutRounding to false is not recommended, and possible scenarios for doing so are not documented here. Ultimately, if you feel that there might be benefit in enabling subpixel rendering for your application, experiment with setting UseLayoutRounding to false, examine the visual results, and make sure that possible rendering artifacts from subpixel rendering do not outweigh the perceived benefits. If you do set UseLayoutRounding to false, always do so on the root of your XAML page or object tree.

.NET Framework Equivalent

None.

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRUIElement
IXRUIElement::GetUseLayoutRounding