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中繼資料, true以將中繼資料屬性設定為。When 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

適用於

另請參閱