共用方式為


Viewbox.Stretch 屬性

定義

取得或設定 ViewboxStretch 模式,決定內容如何融入可用空間。

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

屬性值

這決定 Stretch 了內容在可用空間中的定位。 預設值為 Uniform

範例

以下範例展示了如何建立 的 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;

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

備註

相依財產資訊

項目 價值
識別碼欄位 StretchProperty
元資料屬性設為 true AffectsMeasure

適用於

另請參閱