Viewbox.StretchDirection 屬性

定義

取得或設定 StretchDirection,決定如何將縮放套用至 Viewbox 的內容。

public:
 property System::Windows::Controls::StretchDirection StretchDirection { System::Windows::Controls::StretchDirection get(); void set(System::Windows::Controls::StretchDirection value); };
public System.Windows.Controls.StretchDirection StretchDirection { get; set; }
member this.StretchDirection : System.Windows.Controls.StretchDirection with get, set
Public Property StretchDirection As StretchDirection

屬性值

StretchDirection,決定如何將縮放套用至 Viewbox 的內容。 預設為 Both

範例

下列範例示範如何建立 的 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

備註

這個屬性會決定套用至 之內容的 Viewbox 縮放限制。 例如,使用這個屬性可防止 的內容 Viewbox 小於或大於其原始大小。

相依性屬性資訊

識別碼欄位 StretchDirectionProperty
設定為 的中繼資料屬性 true AffectsMeasure

適用於

另請參閱