UIElement.UseLayoutRounding 屬性

定義

取得或設定一個值,決定物件及其視覺子樹的渲染是否應該使用捨入行為,使渲染對齊到整像素。

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

void UseLayoutRounding(bool value);
public bool UseLayoutRounding { get; set; }
var boolean = uIElement.useLayoutRounding;
uIElement.useLayoutRounding = boolean;
Public Property UseLayoutRounding As Boolean
<uiElement UseLayoutRounding="bool" />

屬性值

Boolean

bool

如果渲染和版面應使用整像素的四捨五入,則為真;否則,則為錯誤。 預設值為 True

備註

各種 Windows 執行階段 屬性的 Double 類型被用來指定版面所需的值或特性。 最明顯的是 高度寬度 ,但還有很多其他因素。 UseLayoutRounding 的預設值為 true ,會使測量與佈局操作將這些佈局屬性的潛在子像素值四捨五入到最接近的整數值,並渲染與像素邊界對齊的物件。 此行為旨在減少當子像素值渲染並影響子像素邊界兩側像素時可能出現的視覺偽影。 最明顯的例子是當你打算製作出特定顏色的清晰細線時。 如果你測量線條時給出的是子像素值,而版面操作沒有四捨五入成整像素,那麼這條線可能會看起來模糊,甚至會呈現比你預期更暗的色調。

版面四捨五入會影響鋸齒和位置。

這裡未說明將 UseLayoutRounding 設 為 false 的可能情境。 如果你覺得啟用子像素渲染對你的應用程式可能有好處,可以嘗試將 UseLayoutRound ing 設 為假,檢視視覺效果,並確保子像素渲染可能產生的渲染失真不會超過預期的好處。 如果你真的把 UseLayoutRounding 設為 false,通常會在 XAML 頁面或物件樹的根節點設定。

適用於

另請參閱