【发布时间】:2011-11-22 02:43:20
【问题描述】:
WPF 中是否有任何 alpha 阈值?我使用笔刷#01000000,在某些计算机上,它在鼠标点击测试方面是不透明的(用这个笔刷点击表面),但在其他一些计算机上,它被认为是完全透明的并且鼠标点击通过。什么情况?
UPD1:@Alain 不。 IsHitTestVisible 属性独立于 alpha 点击。这里的边框主体在所有计算机上都可以点击:
<Window
x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" WindowStyle="None" AllowsTransparency="True" Background="Transparent">
<Border BorderBrush="Red" BorderThickness="20" Background="#00000000" IsHitTestVisible="True"/>
</Window>
这里不是(但在某些计算机上仍然可以点击——这就是问题所在):
<Window
x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" WindowStyle="None" AllowsTransparency="True" Background="Transparent">
<Border BorderBrush="Red" BorderThickness="20" Background="#01000000" IsHitTestVisible="True"/>
</Window>
IsHitTestVisible 在这两种情况下都是 True。
【问题讨论】: