UIElement.OpacityMask UIElement.OpacityMask UIElement.OpacityMask UIElement.OpacityMask Property

定義

取得或設定套用至任何 Alpha 色板遮罩 (用來遮住此項目的呈現內容) 時實作 Brush 的不透明度遮罩。Gets or sets an opacity mask, as a Brush implementation that is applied to any alpha-channel masking for the rendered content of this element. 這是相依性屬性。This is a dependency property.

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

屬性值

用於不透明度遮罩的筆刷。The brush to use for opacity masking.

範例

下列標記範例顯示套用至ImageBrush另一個Image的不透明度遮罩。The following markup example shows an ImageBrush opacity mask applied to another Image.

<!-- 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 色板值。This property only uses whatever the alpha channel value is for the supplied Brush. 呈現的內容 (紅色Brush、綠色或藍色) 的其他通道會被忽略。The other channels of the Brush's rendered content (Red, Green, or Blue) are ignored.

此目的最Brush常見的ImageBrush是, 可用於各種相片遮罩技術, 例如 vignette。The most typical Brush for this purpose is an ImageBrush, which can be used for a variety of photo masking techniques such as a vignette. 但是可以使用Brush任何已定義LinearGradientBrush的 (例如)。But any defined Brush (such as LinearGradientBrush) can be used.

Extensible Application Markup Language (XAML)Extensible Application Markup Language (XAML)中, 這個屬性值可以使用Brush抽象類別的每個執行專用的內嵌語法。In Extensible Application Markup Language (XAML)Extensible Application Markup Language (XAML), this property value can use an inline syntax that is specific to each implementation of the Brush abstract class. 如需詳細資訊, 請參閱使用純色和漸層繪製的色彩For more information, see Painting with Solid Colors and Gradients Overview.

相依性屬性資訊Dependency Property Information

識別碼欄位Identifier field OpacityMaskProperty
中繼資料屬性設定為trueMetadata properties set to true None

適用於

另請參閱