語言

StretchDirection 列舉

定義

描述縮放如何套用至內容,並將縮放限制為具名座標軸類型。

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

欄位

名稱 值 Description
UpOnly 0

內容只有在比父節點小時才會向上擴展。 若內容較大,則不會進行向下縮放。

DownOnly 1

內容只有在大於父節點時才會向下擴展。 若內容較小,則不會進行放大。

Both 2

內容會根據模式調整以適應家長 Stretch 。

範例

以下範例展示了如何使用程式碼建立 的 Viewbox 實例並設定內容的 StretchDirection 。


// 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

適用於

另請參閱