Visual.IsPixelSnappingEnabled 속성

정의

컴퍼지션 엔진이 렌더링된 시각적 개체를 픽셀 경계에 맞추는지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool IsPixelSnappingEnabled { bool get(); void set(bool value); };
bool IsPixelSnappingEnabled();

void IsPixelSnappingEnabled(bool value);
public bool IsPixelSnappingEnabled { get; set; }
var boolean = visual.isPixelSnappingEnabled;
visual.isPixelSnappingEnabled = boolean;
Public Property IsPixelSnappingEnabled As Boolean

속성 값

Boolean

bool

true 컴퍼지션 엔진이 렌더링된 시각적 개체를 픽셀 경계에 맞추면 이고, 그렇지 않으면 입니다 false. 기본값은 false입니다.

Windows 요구 사항

디바이스 패밀리
Windows 10, version 2104 (10.0.20348.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v12.0에서 도입되었습니다.)

예제

public Visual CreateVisualTree(Compositor compositor)
{
    // Say we have two visuals, one containing an image and one containing text.
    // The image can be resampled and still look fine, but the text looks bad if
    // it doesn't land perfectly on pixel boundaries.
    var root = compositor.CreateContainerVisual();

    var imageVisual = compositor.CreateSpriteVisual();
    ImageLoadingHelper(imageVisual);

    var textVisual = compositor.CreateSpriteVisual();
    TextLoadingHelper(textVisual);

    textVisual.Offset = new Vector3(50, 0, 0);
    textVisual.IsPixelSnappingEnabled = true;

    root.Children.Add(imageVisual);
    root.Children.Add(textVisual);

    return root;
}

적용 대상