Stretch 列舉

定義

描述如何調整內容大小以填滿其配置空間。Describes how content is resized to fill its allocated space.

public enum class Stretch
public enum Stretch
type Stretch = 
Public Enum Stretch
繼承

欄位

Fill 1

內容會調整大小以填滿目的尺寸。The content is resized to fill the destination dimensions. 不會保留長寬比。The aspect ratio is not preserved.

None 0

內容會保留其原始大小。The content preserves its original size.

Uniform 2

內容會調整大小以符合目的尺寸,同時也會保留其原始長寬比。The content is resized to fit in the destination dimensions while it preserves its native aspect ratio.

UniformToFill 3

內容會調整大小以填滿目的尺寸,同時也會保留其原始長寬比。The content is resized to fill the destination dimensions while it preserves its native aspect ratio. 如果目的矩形的長寬比與來源不同,則會裁剪來源內容使其符合目的尺寸。If the aspect ratio of the destination rectangle differs from the source, the source content is clipped to fit in the destination dimensions.

範例

下列範例示範如何使用程式碼來建立的實例 Viewbox ,並設定 Stretch 其內容的模式。The following example shows how to create an instance of a Viewbox and set the Stretch mode of its content by using code.


// Create a Viewbox and add it to the Canvas
myViewbox = gcnew Viewbox();
myViewbox->StretchDirection = StretchDirection::Both;
myViewbox->Stretch = Stretch::Fill;
myViewbox->MaxWidth = 400;
myViewbox->MaxHeight = 400;

// Create a Viewbox and add it to the Canvas
myViewbox = new Viewbox();
myViewbox.StretchDirection = StretchDirection.Both;
myViewbox.Stretch = Stretch.Fill;
myViewbox.MaxWidth = 400;
myViewbox.MaxHeight = 400;

' Create a ViewBox and add it to the Canvas
Dim myViewbox As New Viewbox()
myViewbox.StretchDirection = StretchDirection.Both
myViewbox.Stretch = Stretch.Fill
myViewbox.MaxWidth = 400
myViewbox.MaxHeight = 400

備註

下圖顯示不同的 Stretch 值。The following illustration shows the different Stretch values.

不同的 TileBrush 縮放設定Different TileBrush Stretch settings
Stretch 值Stretch values

適用於