GradientBrush.MappingMode 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定 BrushMappingMode 列舉,這個列舉指定漸層筆刷定位座標是絕對座標還是相對於輸出區域的座標。
public:
property System::Windows::Media::BrushMappingMode MappingMode { System::Windows::Media::BrushMappingMode get(); void set(System::Windows::Media::BrushMappingMode value); };
public System.Windows.Media.BrushMappingMode MappingMode { get; set; }
member this.MappingMode : System.Windows.Media.BrushMappingMode with get, set
Public Property MappingMode As BrushMappingMode
屬性值
BrushMappingMode 值,這個值指定如何解譯漸層筆刷定位座標。 預設為 RelativeToBoundingBox。
範例
下列範例示範如何使用 MappingMode 屬性來指定要用於 StartPoint 漸層 和 EndPoint 的座標系統。
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel>
<!-- Both of the rectangles below have identical gradients applied but use different
coordinate systems to specify the StartPoint and EndPoint of the gradient. -->
<Rectangle Width="200" Height="100" Margin="10">
<Rectangle.Fill>
<!-- The MappingMode property is set to "Absolute" which specifies that the coordinate
system used for the StartPoint and EndPoint properties is not relative to the
Brush output area. Values are interpreted directly in local space (in pixels). -->
<LinearGradientBrush MappingMode="Absolute"
StartPoint="0,50" EndPoint="200,50">
<GradientStop Color="Yellow" Offset="0" />
<GradientStop Color="Red" Offset="0.25" />
<GradientStop Color="Blue" Offset="0.75" />
<GradientStop Color="LimeGreen" Offset="1" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle Width="200" Height="100" Margin="10">
<Rectangle.Fill>
<!-- The MappingMode property is set to "RelativeToBoundingBox" (default) which
specifies the coordinate system for the StartPoint and EndPoint are relative to
the Brush output area: 0 indicates 0 percent of the output area and 1 indicates
100 percent of the output area. -->
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<GradientStop Color="Yellow" Offset="0" />
<GradientStop Color="Red" Offset="0.25" />
<GradientStop Color="Blue" Offset="0.75" />
<GradientStop Color="LimeGreen" Offset="1" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
</StackPanel>
</Page>
備註
的值 Absolute 表示漸層筆刷的座標是使用裝置獨立圖元來表示。
相依性屬性資訊
識別碼欄位 | MappingModeProperty |
中繼資料屬性設定為 true |
無 |