制作自定义样式的窗口
2014-05-25 16:54
162 查看
不使用windows自带的窗口样式,使用自定义的客户区,
其中WindowStyle="None"、AllowsTransparency="True" 、Background="Transparent"这三个属性都是要设定的。由于现在默认的非客户区没有了,按下鼠标是不能拖动窗口的,必须在设定鼠标左键按下时的情况,就有了MouseLeftButtonDown="Window_MouseLeftButtonDown" 事件对应的代码:
<Window xmlns:my="clr-namespace:MiniFileTransferClient.Presentation.WPF.UILogic.ShowPanels" x:Class="MiniFileTransferClient.Presentation.WPF.MiniFileTransferViewer" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MiniFileTransferViewer" WindowStyle="None" AllowsTransparency="True" MouseLeftButtonDown="Window_MouseLeftButtonDown" StateChanged="Window_StateChanged" Height="530" Width="395" Background="Transparent"> <Border Height="530" Width="395" BorderBrush="Gray" BorderThickness="0" CornerRadius="5,5,5,5"> <Border.Background> <ImageBrush ImageSource="/MiniFileTransferClient.Presentation.WPF;component/Images/zhujiemian.png"/> </Border.Background> </Border> </Window>
其中WindowStyle="None"、AllowsTransparency="True" 、Background="Transparent"这三个属性都是要设定的。由于现在默认的非客户区没有了,按下鼠标是不能拖动窗口的,必须在设定鼠标左键按下时的情况,就有了MouseLeftButtonDown="Window_MouseLeftButtonDown" 事件对应的代码:
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { this.DragMove(); }
相关文章推荐
- 自定义WPF 窗口样式
- 【百度地图API】如何制作自定义样式的公交导航结果面板?
- WPF 自定义窗口,自定义控件和样式
- wpf日历控件制作过程分析(2)---自定义样式属性
- jQuery实现自定义样式的弹出窗口和确认框
- jquery控件-实现自定义样式的弹出窗口和确认框
- 【百度地图API】如何制作自定义样式的公交导航结果面板?
- java Web使用div模拟模态窗口,可以自定义样式--------------------subModal
- android 自定义spinner的下拉弹出窗口样式
- 【安卓】如何制作Spinner的Hint提示效果,并自定义Spinner样式
- 如何利用【百度地图API】,制作房产酒店地图?(上)——制作自定义标注和自定义信息窗口
- 如何利用【百度地图API】,制作房产酒店地图?(上)——制作自定义标注和自定义信息窗口
- 自定义WPF 窗口样式{转}
- 如何利用【百度地图API】,制作房产酒店地图?(上)——制作自定义标注和自定义信息窗口
- 【JQuery】控件-实现自定义样式的弹出窗口和确认框
- 自定义一个Dialog样式的Activity窗口,切换到Dialog的方法
- Qt自定义样式/无边框窗口/子窗口模态/非模态问题
- WPF自定义窗口样式小技巧
- 自定义WPF 窗口样式
- wpf日历控件制作过程分析(2)---自定义样式属性