こんにちは。
Windows10でWPFのアプリケーションを開発しています。
Visual Studio 2015 Communityを使っています。
###前提・実現したいこと
displayが輝度を最低にしてもなおまだ明るいので、最前面に半透明のウィンドウを置いて暗くしようと考えました。
###試したこと
下記コードのとおり。
ほかにWindowをIsHitTestVisible="False"にもしてみました。
###発生している問題・エラーメッセージ
Buttonを押せるので、BlackCurtainは透過しているのですが、他のウィンドウのobjectは透過して見えているにもかかわらず操作できません。
###該当のソースコード
xaml
1<Window x:Class="BlackCurtain.MainWindow" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 5 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 6 xmlns:local="clr-namespace:BlackCurtain" 7 mc:Ignorable="d" 8 Title="MainWindow" 9 WindowState="Maximized" 10 WindowStyle="None" 11 Background="Transparent" 12 AllowsTransparency="True" 13 > 14 <Grid x:Name="BlackCurtainGrid"> 15 <Button x:Name="button" Content="Button" HorizontalAlignment="Left" Margin="205,152,0,0" VerticalAlignment="Top" Width="75" Click="button_Click"/> 16 <Rectangle Margin="0,0,0,0" IsHitTestVisible="False"> 17 <Rectangle.Fill> 18 <SolidColorBrush Color="Black" Opacity="0.15"/> 19 </Rectangle.Fill> 20 </Rectangle> 21 <Button x:Name="button2" Content="Button" HorizontalAlignment="Left" Margin="231,369,0,0" VerticalAlignment="Top" Width="75" Click="button_Click"/> 22 </Grid> 23</Window>
C#
1using System.Windows; 2using System.Windows.Controls; 3 4namespace BlackCurtain { 5 public partial class MainWindow : Window { 6 public MainWindow() { 7 InitializeComponent(); 8 } 9 10 private void button_Click(object sender, RoutedEventArgs e) { 11 Button button = sender as Button; 12 MessageBox.Show(button.Name); 13 } 14 } 15}
###補足情報(言語/FW/ツール等のバージョンなど)
Microsoft Visual Studio Community 2015
Version 14.0.25424.00 Update 3
Microsoft .NET Framework
Version 4.6.01038
インストールしているバージョン:Community
Visual C# 2015 00322-20000-00000-AA575
Microsoft Visual C# 2015
です。
よろしくお願いします。

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/11/07 04:28
2016/11/07 04:47