UIElement.OpacityMask 屬性
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定套用至任何 Alpha 色板遮罩 (用來遮住此項目的呈現內容) 時實作 Brush 的不透明度遮罩。 這是相依性屬性。
public:
property System::Windows::Media::Brush ^ OpacityMask { System::Windows::Media::Brush ^ get(); void set(System::Windows::Media::Brush ^ value); };
C#
public System.Windows.Media.Brush OpacityMask { get; set; }
member this.OpacityMask : System.Windows.Media.Brush with get, set
Public Property OpacityMask As Brush
用於不透明度遮罩的筆刷。
下列標記範例顯示套用至另一個 ImageBrush Image 的不透明度遮罩。
XAML
<!-- With the Opacity Mask-->
<Image
Height="150"
Width="200"
Source="sampleImages/Waterlilies.jpg"
HorizontalAlignment="Left"
Margin="10"
Grid.Column="2" Grid.Row="1">
<Image.OpacityMask>
<ImageBrush ImageSource="sampleImages/tornedges.png"/>
</Image.OpacityMask>
</Image>
這個屬性只會針對提供的 Brush 使用任何 Alpha 色板值。 會忽略 所呈現內容的其他通道 Brush (紅色、綠色或藍色) 。
此用途最典型的 Brush 是 ImageBrush ,可用於各種相片遮罩技術,例如 vignette。 但是可以使用任何定義的 Brush (,例如 LinearGradientBrush) 。
在 Extensible Application Markup Language (XAML) 中,這個屬性值可以使用抽象類別每個實作 Brush 特有的內嵌語法。 如需詳細資訊,請參閱 使用純色和漸層繪製概觀。
識別碼欄位 | OpacityMaskProperty |
中繼資料屬性設定為 true |
無 |
產品 | 版本 |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 |
Windows Desktop | 3.0, 3.1, 5, 6, 7 |