如何使 WS_THICKFRAME 不可见,但在 MFC 中仍然有效?

How to make WS_THICKFRAME invisible, but still functional in MFC?(如何使 WS_THICKFRAME 不可见,但在 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 中仍然有效?

基础教程推荐