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

定义

获取或设置一个作为 Brush 实现的不透明蒙板,该蒙板可应用到此元素所呈现内容的任何 Alpha 通道蒙板。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>

注解

此属性仅使用 alpha 通道值为提供Brush的。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.

可扩展应用程序标记语言 (XAML)Extensible Application Markup Language (XAML)中, 此属性值可以使用特定于Brush抽象类的每个实现的内联语法。In 可扩展应用程序标记语言 (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 NoneNone

适用于

另请参阅