WPR-007:WPF中窗体的透明设置
2013-02-28 17:18
811 查看
一般使用WindowStyle=,Background=,AllowsTransparency,Opacity来进行设置。
1、设置Opacity控制整个窗口的透明,包括上面的控件
这种可是使用自定义的控件形状,来使窗体呈现自定义的形状
依然使用Background设置颜色
工程代码下载:http://download.csdn.net/detail/yysyangyangyangshan/5096470
本文出自 “西北白杨树” 博客,请务必保留此出处http://yangyoushan.blog.51cto.com/7229571/1276422
1、设置Opacity控制整个窗口的透明,包括上面的控件
Window x:Class="TestTransparentWindow.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="441" Width="870" WindowStyle="None" AllowsTransparency="True" Opacity="0.5"> <Grid Width="500" Height="300" Background="Black"> </Grid> </Window>2、窗体空白部分全部透明,控件部分显示颜色
这种可是使用自定义的控件形状,来使窗体呈现自定义的形状
<Window x:Class="TestTransparentWindow.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="441" Width="870" WindowStyle="None" AllowsTransparency="True" Background="#00FFFFFF"> <Grid Width="500" Height="300" Background="Black"> </Grid> </Window>3、空白部分半透明,控件部分不透明
依然使用Background设置颜色
<Window x:Class="TestTransparentWindow.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="441" Width="870" WindowStyle="None" AllowsTransparency="True" Background="#AA000000"> <Grid Width="500" Height="300" Background="Black"> </Grid> </Window>
工程代码下载:http://download.csdn.net/detail/yysyangyangyangshan/5096470
本文出自 “西北白杨树” 博客,请务必保留此出处http://yangyoushan.blog.51cto.com/7229571/1276422
相关文章推荐
- WPR-007:WPF中窗体的透明设置
- 设置窗体透明 隐藏任务栏 与全屏显示
- Qt中设置QML窗体无边框和背景透明
- wpf中如何将窗口设置为透明
- WPF的窗体设置WindowStyle=none时,如何移动窗体
- 设置窗体透明、黑暗度、背景模糊的方法
- WPF 设置类库项目为启动项,设置窗体跟随。
- WPF无边框透明窗体的缩放
- jswing中为dialog设置透明窗体
- 设置窗体透明 隐藏任务栏 与全屏显示 .
- C# WPF设置窗口透明
- WPF中设置窗体不平铺背景图
- 设置窗体及空间透明、半透明
- Hello Android - android窗体透明的,黑暗度等的设置技巧
- WPF如何实现窗体透明——Opacity
- SWT 设置窗体透明和最上
- 设置窗体上控件的背景色,设置控件背景色为透明
- C#五行代码设置透明窗体效果
- 窗体透明,窗体上控件不透明的设置方法
- Winform程序中在窗体设置Lable的背景色为透明