StretchDirection 列舉

定義

描述縮放比例如何套用至內容,並限制具名軸類型的縮放比例。

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

欄位

Both 2

內容會根據 Stretch 模式自動縮放以符合父代。

DownOnly 1

只有當內容大於父代時,才會縮小。 如果內容較小,不會放大。

UpOnly 0

只有當內容小於父代時,才會放大。 如果內容較大,不會縮小。

範例

下列範例示範如何使用程式碼建立 和 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

適用於

另請參閱