使用半透明窗口和“透明输入”创建应用程序

时间:2015-03-01 18:49:53

标签: c# windows transparency

我想用透明窗口创建一个应用程序。我想在这个窗口的背景放一张图片,并使窗口对输入透明(例如,如果我点击窗口,如果没有这个应用程序,就像我在屏幕上点击一样)。我想在应用程序启动时为输入alpha创建输入框。是否有可能在c#中创建这样的应用程序?如果是,那么最好的方法是什么?

1 个答案:

答案 0 :(得分:0)

您可以通过WPF应用程序中的以下XAML代码创建透明窗口。您可以在0和1之间改变不透明度值以获得所需的透明度。要获得完全透明,请使用0。

<Window x:Class="WpfApplication3.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        AllowsTransparency="True" WindowStyle="None" IsActive="False">
    <Window.Background>
        <SolidColorBrush Opacity="0.5" Color="White"/>
    </Window.Background>
    <Grid>
        <TextBox Width="200" Height="50"/>
    </Grid>
</Window>
相关问题