Stretch 列舉
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
描述如何調整內容大小以填滿其配置空間。
public enum class Stretch
C#
public enum Stretch
type Stretch =
Public Enum Stretch
- 繼承
名稱 | 值 | Description |
---|---|---|
Fill | 1 | 內容會調整大小以填滿目的尺寸。 不會保留長寬比。 |
None | 0 | 內容會保留其原始大小。 |
Uniform | 2 | 內容會調整大小以符合目的尺寸,同時也會保留其原始長寬比。 |
UniformToFill | 3 | 內容會調整大小以填滿目的尺寸,同時也會保留其原始長寬比。 如果目的矩形的長寬比與來源不同,則會裁剪來源內容使其符合目的尺寸。 |
下列範例示範如何使用程式碼建立 的 Viewbox 實例,並設定 Stretch 其內容的模式。
// 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;
C#
// 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 值。
延展值
產品 | 版本 |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |