TileBrush.ViewportUnits 属性


获取或设置一个 BrushMappingMode 枚举,该枚举指定 Viewport 的值(该值指示 TileBrush 基本图块的大小和位置)是否相对于输出区域的大小。Gets or sets a BrushMappingMode enumeration that specifies whether the value of the Viewport, which indicates the size and position of the TileBrush base tile, is relative to the size of the output area.

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


指示 Viewport 的值(该值描述 TileBrush 图块的大小和位置)是否相对于整个输出区域的大小而言。Indicates whether the value of the Viewport, which describes the size and position of the TileBrush tiles, is relative to the size of the whole output area. 默认值为 RelativeToBoundingBoxThe default value is RelativeToBoundingBox.


@No__t-0 属性确定 @no__t 中磁贴的大小和位置。The Viewport property determines the size and position of the tiles in a TileBrush. 默认情况下,@no__t 的单个磁贴将填充整个输出区域。By default, a TileBrush has a single tile that fills the whole output area. @No__t-0 属性控制 @no__t 的内容如何适应该磁贴。The Stretch property controls how the TileBrush content fits into that tile. 您可以使用 @no__t 的属性重写此默认行为并指定磁贴大小。You can override this default behavior and specify the tile size by using the Viewport property.

使用 ViewportUnits 属性来指定 Viewport 是使用绝对坐标还是相对坐标。Use the ViewportUnits property to specify whether the Viewport uses absolute or relative coordinates. 如果坐标是相对坐标,则它们相对于输出区域的大小。If the coordinates are relative, they are relative to the size of the output area. 点(0,0)表示输出区域的左上角,(1,1)表示输出区域的右下角。The point (0,0) represents the upper-left corner of the output area, and (1,1) represents the lower-right corner of the output area. 若要指定 Viewport 属性使用绝对坐标,请将 @no__t 属性设置为 AbsoluteTo specify that the Viewport property uses absolute coordinates, set the ViewportUnits property to Absolute.

下图显示了在将 @no__t 的 @no__t 属性设置为相对或绝对时,输出中的差异。The following illustration shows the difference in output when you set the ViewportUnits property of a TileBrush to either relative or absolute.

绝对和相对视区单位Absolute and Relative Viewport Units
相对和绝对 System.windows.media.tilebrush.viewportunitsRelative and absolute ViewportUnits

依赖项属性信息Dependency Property Information

标识符字段Identifier field ViewportUnitsProperty
元数据属性设置为 trueMetadata properties set to true NoneNone