UIElement.OpacityMask 屬性

定義

取得或設定套用至任何 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.

範例

下列標記範例顯示套用至另一個 ImageImageBrush 不透明度遮罩。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.

此用途最常見的 BrushImageBrush,可用於各種相片遮罩技術,例如 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
設定為 true 的中繼資料屬性Metadata properties set to true None

適用於

另請參閱