如何使用 WPF 实现无边框窗口? [英] How do I implement a chromeless window with WPF?

查看:33
本文介绍了如何使用 WPF 实现无边框窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在右上角显示一个带有关闭按钮的无边框模式窗口.这可能吗?

I want to show a chromeless modal window with a close button in the upper right corner. Is this possible?

推荐答案

您几乎必须滚动自己的关闭按钮,但您可以使用 WindowStyle 属性完全隐藏窗口镶边,如下所示:

You'll pretty much have to roll your own Close button, but you can hide the window chrome completely using the WindowStyle attribute, like this:

<Window WindowStyle="None">

那仍然会有一个调整大小的边框.如果您想让窗口不可调整大小,请在声明中添加 ResizeMode="NoResize".

That will still have a resize border. If you want to make the window non-resizable then add ResizeMode="NoResize" to the declaration.

这篇关于如何使用 WPF 实现无边框窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆