有什么方法可以限制图像特定区域的像素着色器。
BR
绘制布局(网格、画布等),使一个或多个单元格包含限制区域。然后在该特定区域上绘制一个 Rectangle 或 Border 控件以获得所需的效果。请记住首先添加 Rectangle,或者使用 ZIndex,如下所示,这样您的代码就不会隐藏任何控件。
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Grid.Row="1" Panel.ZIndex="0" >
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="Fill" Value="Blue"/>
</Style>
</Rectangle.Style>
</Rectangle >
<TextBox Grid.Column="0" Grid.Row="1" Height="25" Margin="10" Text="Test 123" Panel.ZIndex="1" />
</Grid>