删除窗口边框? [英] Removing window border?

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

问题描述

我有一个窗口,周围有实心边框.如何使用 SetWindowLongGetWindowLong 删除边框(所有非客户区)?

I have a window with a solid border around it. How can I remove the border (all of the non-client area) by using SetWindowLong and GetWindowLong?

推荐答案

In C/C++

LONG lStyle = GetWindowLong(hwnd, GWL_STYLE);
lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU);
SetWindowLong(hwnd, GWL_STYLE, lStyle);

WS_CAPTION 定义为 (WS_BORDER | WS_DLGFRAME).您可以只删除这两种样式,因为当标题消失时,最小化最大化和系统菜单也会消失,但最好也删除它们.

WS_CAPTION is defined as (WS_BORDER | WS_DLGFRAME). You can get away with removing just these two styles, since the minimize maximize and sytem menu will disappear when the caption disappears, but it's best to remove them as well.

最好删除扩展边框样式.

It's also best to remove the extended border styles.

LONG lExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
lExStyle &= ~(WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE);
SetWindowLong(hwnd, GWL_EXSTYLE, lExStyle);

最后,为了让您的窗口以更改后的样式重新绘制,您可以使用 SetWindowPos.

And finally, to get your window to redraw with the changed styles, you can use SetWindowPos.

SetWindowPos(hwnd, NULL, 0,0,0,0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);

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

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