WPF:使窗口unresizeable,但保留帧? [英] WPF: Make window unresizeable, but keep the frame?

查看:210
本文介绍了WPF:使窗口unresizeable,但保留帧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有没有标题栏的窗口( WindowStyle == WindowStyle.None )。整个窗口使用的Aero玻璃效果。当我使窗口unresizeable( ResizeMode == ResizeMode.NoResize ),玻璃效果消失了,我只控制在半空中悬挂。 (实际上,窗口本身消失,但离开它的内容。)

I have a window that does not have a title bar (WindowStyle == WindowStyle.None). The entire window uses the Aero glass effect. When I make the window unresizeable (ResizeMode == ResizeMode.NoResize), the glass effect disappears and my controls just hang in midair. (Essentially, the window itself disappears but leaves its contents.)

有没有我做不摆脱窗框的窗户unresizeable的方式?

Is there a way for me to make the window unresizeable without getting rid of the window frame?

我已经阅读问题的 启用一个无国界的WPF窗口在Vista玻璃效果,但是这不是很我想要的 - 我想保持窗口边框。对于什么,我想我的窗口,看起来像一个例子,击中航空Alt + Tab键。

I have read the question Enable Vista glass effect on a borderless WPF window, but that's not quite what I want--I would like to keep the window border. For an example of what I would like my window to look like, hit Alt+Tab with Aero enabled.

要澄清我没有要调整大小光标现身在所有悬停窗口边框时。实际上,这就是我希望我的窗口,如下所示:

To clarify, I do no want the resize cursors to show up at all when hovering over the window border. This is essentially what I want my window to look like:

的溶液不必严格WPF - 我很好,以便与在Win32 API周围黑客实现这一

The solution doesn't have to be strictly WPF--I am fine with hacking around with the Win32 API in order to achieve this.

推荐答案

您可以挂钩的WndProc和拦截的WM_WINDOWPOSCHANGING 消息。 。没有严格的WPF,但可能是你最好的选择。

You can hook the wndproc and intercept the WM_WINDOWPOSCHANGING message. Not strictly WPF, but probably your best bet.

如果你想隐藏的大小调整光标,那么最好的办法是截获的WM_NCHITTEST 。调用DefWindowProc函数(获取默认的行为),并测试返回值;如果是HTBOTTOM,HTBOTTOMLEFT,HTBOTTOMRIGHT,HTTOP,HTTOPLEFT或HTTOPRIGHT,改变返回值HTBORDER。

If you want to hide the resize cursors, then your best bet is to intercept WM_NCHITTEST. Call the DefWindowProc (to get the default behavior), and test the return value; if it's HTBOTTOM, HTBOTTOMLEFT, HTBOTTOMRIGHT, HTTOP, HTTOPLEFT, or HTTOPRIGHT, change the return value to HTBORDER.

这篇关于WPF:使窗口unresizeable,但保留帧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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