一般做wpf窗口时都不会使用默认的标题栏等,会把他隐藏掉

此时设置以下属性

WindowStyle、AllowsTransparency、ResizeMode

中的两个或三个都能达到目的。

有一种场景,针对.Net 4.0及以下版本,4.5 直接就支持操作

1. 隐藏边框

2.保留鼠标移动到窗体四周,仍能拉伸或缩小窗体尺寸的功能

窗口顶部的白色操作条隐藏不小,wpf没直接提供相关操作途径,如下图 :

可以借助WPFShell处理,地址:nuget地址:https://www.nuget.org/packages/WPF.Shell.Integration.Library/

代码:

<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication1"
xmlns:wpfShell="clr-namespace:Microsoft.Windows.Shell;assembly=Microsoft.Windows.Shell"
WindowStyle="None"
AllowsTransparency="False"
ResizeMode="CanResize"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<wpfShell:WindowChrome.WindowChrome>
<wpfShell:WindowChrome CaptionHeigth="0" ResizeBorderThickness="5px 5px 5px 5px"> </wpfShell:WindowChrome>
</wpfShell:WindowChrome.WindowChrome>
<Grid Background="Gray"> </Grid>
</Window>

  记录,已备下次遗忘

WPF 窗体边框处理的更多相关文章

  1. C# .net WPF无边框移动窗体

    转自 http://download.csdn.net/detail/xiang348352/3095084 WPF无边框移动窗体,先在<Window>里添加 MouseLeftButto ...

  2. wpf无边框窗体移动和大小调整

    原文:wpf无边框窗体移动和大小调整   using System; using System.Windows; using System.Windows.Interop; namespace Wpf ...

  3. WPF实用指南一:在WPF窗体的边框中添加搜索框和按钮

    原文:WPF实用指南一:在WPF窗体的边框中添加搜索框和按钮 在边框中加入一些元素,在应用程序的界面设计中,已经开始流行起来.特别是在浏览器(Crome,IE,Firefox,Opera)中都有应用. ...

  4. WPF无边框移动窗体

    WPF无边框移动窗体,先在<Window>里添加 MouseLeftButtonDown=”Window_MouseLeftButtonDown” 然后导航到事件,在事件里添加 if (e ...

  5. WPF 去除系统窗体边框,自定义移动窗体

    方法一: 去除系统窗体边框: <Window x:Class="PracticeProject.MainWindow" xmlns="http://schemas. ...

  6. WPF去除窗体边框及白色边框

    <Window x:Class="WpfAppFirst.Evaluation" xmlns="http://schemas.microsoft.com/winfx ...

  7. 自定义WPF窗体形状

    介绍 你好WPF爱好者. 随着WPF等统一API语言的发明,丰富用户界面变得非常容易. 创建丰富的用户界面只是一个想法. 您需要拥有的是创造性思维和最新技术融合. WPF和Expression Ble ...

  8. WPF无边框捕获消息改变窗口大小

    原文:WPF无边框捕获消息改变窗口大小 文章大部分转载自http://blog.csdn.net/fwj380891124,如有问题,请联系删除  最近一直在学习 WPF,看着别人做的WPF程序那么漂 ...

  9. WinForm 与WPF 窗体之间的想到调用

    先放置一个容器控件,并设计 好WinForm(或WPF)窗口 winform 调用 wpf ElementHost el = new ElementHost(); el.Dock = DockStyl ...

随机推荐

  1. ZOJ Monthly, June 2014 解题报告

    A.Another Recurrence Sequence problemId=5287">B.Gears 题目大意:有n个齿轮,一開始各自为一组.之后进行m次操作,包含下面4种类型: ...

  2. Java泛型解析(02):通配符限定

    Java泛型解析(02):通配符限定      考虑一个这种场景.计算数组中的最大元素. [code01] public class ArrayUtil { public static <T&g ...

  3. TensorFlow 学习(十一)—— 正则(regularizer)

    正则作用的对象是目标函数,如图对均方误差使用 ℓ2 正则: loss = tf.reduce_mean(tf.square(y-y_) + tf.contrib.layers.l2_regulariz ...

  4. 输入框改变placeholder字体颜色

    ::-webkit-input-placeholder {  color: red;}:-moz-placeholder {  color: red;}::-moz-placeholder{color ...

  5. 亲测有效,解决Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2) ";

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/hjf161105/article/details/78850658 最近租了一个阿里云云翼服务器,趁 ...

  6. 在CentOS系统上将deb包转换为rpm包

    转载自 http://www.heminjie.com/system/linux/1487.html deb文件格式本是ubuntu/debian系统下的安装文件,那么我想要在redhat/cento ...

  7. QT5.8.0+MSVC2015安装以及环境配置(不需要安装VS2015)

    原文:QT5.8.0+MSVC2015安装以及环境配置(不需要安装VS2015) 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/snow_rain_ ...

  8. 利用WPF建立自己的3d gis软件(非axhost方式)(十三)万能的用户层接口,(强大的WPF)

    原文:利用WPF建立自己的3d gis软件(非axhost方式)(十三)万能的用户层接口,(强大的WPF) 先下载SDK:https://pan.baidu.com/s/1M9kBS6ouUwLfrt ...

  9. ios 应用发布appStore

    1.进入管理界面开发商 [点击 iTunes Connect] 2.进入管理apps界面 [点击 Manage Your Apps] watermark/2/text/aHR0cDovL2Jsb2cu ...

  10. 嵌套函数中的this

    function countDown(){ var self = this; var doWork = function(){ console.log(this);//window console.l ...