UIElement.SnapsToDevicePixels UIElement.SnapsToDevicePixels UIElement.SnapsToDevicePixels UIElement.SnapsToDevicePixels Property

定義

取得或設定值,該值判斷這個項目的呈現在呈現期間是否該使用裝置特定像素的設定。Gets or sets a value that determines whether rendering for this element should use device-specific pixel settings during rendering. 這是相依性屬性。This is a dependency property.

public:
 property bool SnapsToDevicePixels { bool get(); void set(bool value); };
public bool SnapsToDevicePixels { get; set; }
member this.SnapsToDevicePixels : bool with get, set
Public Property SnapsToDevicePixels As Boolean

屬性值

如果此項目應該根據裝置像素來呈現,則為 true;否則為 falsetrue if the element should render in accordance to device pixels; otherwise, false. UIElement 上所宣告的預設值是 falseThe default as declared on UIElement is false.

備註

您可以將此屬性設定為true在您的根項目,若要啟用像素貼齊呈現整個 UI。You can set this property to true on your root element to enable pixel snap rendering throughout the UI. 適用於裝置以大於 96 操作DPI (每英吋的點數)dots per inch (dpi),像素貼齊呈現可以最小化元件單一單位實線附近的消除鋸齒視覺成品。For devices operating at greater than 96 DPI (每英吋的點數)dots per inch (dpi), pixel snap rendering can minimize anti-aliasing visual artifacts in the vicinity of single-unit solid lines.

當繼承FrameworkElement任何可能衍生的類別,或FrameworkElement覆寫來設定此相依性屬性的中繼資料Inherits中繼資料屬性來trueWhen inherited by FrameworkElement or any possible derived classes, FrameworkElement overrides the metadata for this dependency property to set the Inherits metadata property to true. 這種做法是只最外層項目的子樹狀目錄中的必須指定SnapsToDevicePixels做為true,然後將會報告該樹狀子目錄的所有子項目SnapsToDevicePixels作為true,而且必須SnapsToDevicePixels視覺效果。What this achieves is that only the outermost element in a subtree needs to specify SnapsToDevicePixels as true, and all child elements of that subtree will then report SnapsToDevicePixels as true and will have the SnapsToDevicePixels visual effect.

相依性屬性資訊Dependency Property Information

識別項欄位Identifier field SnapsToDevicePixelsProperty
若要設定的中繼資料屬性 trueMetadata properties set to true None

適用於

另請參閱