How to make WS_THICKFRAME invisible, but still functional in MFC?(如何使 WS_THICKFRAME 不可见,但在 MFC 中仍然有效?)
问题描述
所以,我创建了一个具有以下样式的对话框:WS_THICKFRAME.这个 WS_THICKFRAME 为对话框提供了调整窗口大小的功能,但我的问题是我的窗口周围的边框不可见.如何使边框不可见,但仍具有调整大小的功能?
So, I created a dialog that has a style: WS_THICKFRAME. This WS_THICKFRAME gives the dialog box the functionality to resize the window, but my problems is that I don't won't a border around my window to be visible. How would I make the border invisible, but still have the re-size capability?
举个例子会很有帮助!谢谢!
An example would be most helpful! Thanks!
下面是我创建的对话框的模板样式:
Below, are the styles of the template for the dialog box I created:
IDD_GADGETTRANSLUCENTDIALOG DIALOGEX 0, 0, 320, 200
STYLE DS_ABSALIGN | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_SYSMENU | WS_THICKFRAME
推荐答案
移除 WS_THICKFRAME
Remove WS_THICKFRAME
大致如下处理WM_NCHITTEST:
Handle WM_NCHITTEST roughly as follows:
UINT CMyClass::OnNcHitTest(CPoint point)
{
CRect rWindow;
GetWindowRect(rWindow);
CRect rInner(rWindow);
rInner.DeflateRect(GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
if (rWindow.PtInRect(point) && !rInner.PtInRect(point))
{
// figure out which of the following codes to return: //
// HTBOTTOM, HTTOP, HTLEFT, HTRIGHT //
// HTBOTTOMLEFT, HTBOTTOMRIGHT, HTTOPLEFT, HTTOPRIGHT //
}
else
{
return CMyBaseClass::OnNcHitTest(point);
}
}
这篇关于如何使 WS_THICKFRAME 不可见,但在 MFC 中仍然有效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使 WS_THICKFRAME 不可见,但在 MFC 中仍然有效?


- 使用/clr 时出现 LNK2022 错误 2022-01-01
- STL 中有 dereference_iterator 吗? 2022-01-01
- 静态初始化顺序失败 2022-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07
- 近似搜索的工作原理 2021-01-01
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- 从python回调到c++的选项 2022-11-16
- Stroustrup 的 Simple_window.h 2022-01-01
- C++ 协变模板 2021-01-01