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

适用于

另请参阅