首页 新闻 会员 周边

设置WPF程序AllowsTransparency="True",在xp下textbox控件之间会相互遮罩嘛

0
悬赏园豆:15 [已关闭问题] 关闭于 2016-10-07 08:14

<Window
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 x:Class="wfaa.MainWindow"
 x:Name="Window"
 Title="wLogin"
 Width="360" Height="260" WindowStyle="none" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Background="Transparent">
    <Grid x:Name="LayoutRoot" Margin="0,0,0,0" Background="white">
        <Grid.RowDefinitions>
            <RowDefinition Height="112*" />
            <RowDefinition Height="34*" />
            <RowDefinition Height="34*" />
            <RowDefinition Height="41*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="118*" />
            <ColumnDefinition Width="220*" />
        </Grid.ColumnDefinitions>
        <TextBox Background="Transparent" Grid.Row="1" Height="25" HorizontalAlignment="Left" Margin="74,0,0,0" Name="textBox1" VerticalAlignment="Top" Width="164" Grid.ColumnSpan="2" />
        <PasswordBox Background="Transparent" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="74,0,0,0" Name="passwordBox1" VerticalAlignment="Top" Width="164" Grid.ColumnSpan="2" />
        <TextBlock Height="47" HorizontalAlignment="Left" Margin="74,46,0,0" Name="textBlock1" Text="Hello" VerticalAlignment="Top" Width="133" FontSize="26" Grid.ColumnSpan="2" FontWeight="Bold" />
    </Grid>
</Window>

 

win7下:

 

winXP下:

ChenYa.Liu的主页 ChenYa.Liu | 初学一级 | 园豆:3
提问于:2015-08-29 09:34
< >
分享
所有回答(1)
0

AllowsTransparency 是设置窗口透明的,你要的textbox不遮挡后面的内容的话,设置textbox的属性 :Background="Transparent" 即可。

天方 | 园豆:5407 (大侠五级) | 2015-08-29 10:35

是我没描述好。你误会我的意思了。这个textBox是放在grid里面的。grid的背景是白色的。在win7上可以显示全部样式。可是在winxp(虚拟机)上,整个窗体就只显示一个textBox。我重新截两个图,你帮我看看。

 

支持(0) 反对(0) ChenYa.Liu | 园豆:3 (初学一级) | 2015-08-29 10:48

@ChenYa.Liu: 

我试了一下,在xp下也可以透明的,但你的例子中把最底部的grid背景设置为white,在xp和win7下应该都是白色背景才对,应该把背景色也设置为透明。

支持(0) 反对(0) 天方 | 园豆:5407 (大侠五级) | 2015-08-29 14:41
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册