WPF 窗体边框处理
一般做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 窗体边框处理的更多相关文章
- C# .net WPF无边框移动窗体
转自 http://download.csdn.net/detail/xiang348352/3095084 WPF无边框移动窗体,先在<Window>里添加 MouseLeftButto ...
- wpf无边框窗体移动和大小调整
原文:wpf无边框窗体移动和大小调整 using System; using System.Windows; using System.Windows.Interop; namespace Wpf ...
- WPF实用指南一:在WPF窗体的边框中添加搜索框和按钮
原文:WPF实用指南一:在WPF窗体的边框中添加搜索框和按钮 在边框中加入一些元素,在应用程序的界面设计中,已经开始流行起来.特别是在浏览器(Crome,IE,Firefox,Opera)中都有应用. ...
- WPF无边框移动窗体
WPF无边框移动窗体,先在<Window>里添加 MouseLeftButtonDown=”Window_MouseLeftButtonDown” 然后导航到事件,在事件里添加 if (e ...
- WPF 去除系统窗体边框,自定义移动窗体
方法一: 去除系统窗体边框: <Window x:Class="PracticeProject.MainWindow" xmlns="http://schemas. ...
- WPF去除窗体边框及白色边框
<Window x:Class="WpfAppFirst.Evaluation" xmlns="http://schemas.microsoft.com/winfx ...
- 自定义WPF窗体形状
介绍 你好WPF爱好者. 随着WPF等统一API语言的发明,丰富用户界面变得非常容易. 创建丰富的用户界面只是一个想法. 您需要拥有的是创造性思维和最新技术融合. WPF和Expression Ble ...
- WPF无边框捕获消息改变窗口大小
原文:WPF无边框捕获消息改变窗口大小 文章大部分转载自http://blog.csdn.net/fwj380891124,如有问题,请联系删除 最近一直在学习 WPF,看着别人做的WPF程序那么漂 ...
- WinForm 与WPF 窗体之间的想到调用
先放置一个容器控件,并设计 好WinForm(或WPF)窗口 winform 调用 wpf ElementHost el = new ElementHost(); el.Dock = DockStyl ...
随机推荐
- [Ramda] Sort, SortBy, SortWith in Ramda
The difference between sort, sortBy, sortWith is that: 1. sort: take function as args. 2. sortBy: ta ...
- Opencv Sift和Surf特征实现图像无缝拼接生成全景图像
Sift和Surf算法实现两幅图像拼接的过程是一样的,主要分为4大部分: 1. 特征点提取和描述 2. 特征点配对,找到两幅图像中匹配点的位置 3. 通过配对点,生成变换矩阵,并对图像1应用变换矩阵生 ...
- android 如何创建配置文件和读配置文件
因为一些配置信息,多处用到的.且以后可能变更的,我想写个.prorperties配置文件给管理起来.在studio中新建一个Assets文件-->新建一个file文件类型为properties文 ...
- 数据集(benchmark)、常用数据集的解析(cifar-10、)
What is the class of this image ? 主要是以下常见的数据集,用以衡量算法的分类准确率: mnist.cifar-10.cifar-100stl-10 svhn.ILSV ...
- Vue中import '@...'是什么
今天看新项目代码,有import '@/assets/css/theme/index.css'一类的代码,里面的@是做什么的呢. 找到这篇文章https://www.cnblogs.com/bos ...
- Method for training dynamic random access memory (DRAM) controller timing delays
Timing delays in a double data rate (DDR) dynamic random access memory (DRAM) controller (114, 116) ...
- oracle的number的浅析
author:skate time:2011-02-14 oracle的number的浅析 从例如以下几个方面来认识number 1.表示的数值范围 2.占用的存储空间 3.number的性能 ...
- .net命名空间和程序集详解
命名空间是一种用于将逻辑上相似的类按层次结构分组的机制.这种机制防止了命名冲突.在这种结构化采用被点号"."分隔的单词来实现.通常最顶层的命名空间是System,例如System; ...
- [C++] 反编译器
各种开源的decompiler都不太好用,眼下最好的反编译器是IDA pro. 尽管是收费的,只是破解版非常好找. 我试过5.5版本号的,还不错. 我把windows notepad进行了反编译,多少 ...
- QWidget 之paint部分杂记(从Qt4.0到4.8的进化,在Qt 4.4中,Alien Widget诞生了)
Qt 4.0 automatically double-buffers Qt 4.1 QWidget::autoFillBackground Qt 4.2 delayed widget creatio ...