GetBorderSize

MFC 2013. 11. 18. 14:35
CSize GetBorderSize(const CWnd& window)
{
   if (window.IsZoomed())
   {
      // The total border size is found by subtracting the size of the client rect
      // from the size of the window rect. Note that when the window is zoomed, the
      // borders are hidden, but the title bar is not.
      CRect wndRect, clientRect;
      window.GetWindowRect(&wndRect);
      window.GetClientRect(&clientRect);
      return wndRect.Size() - clientRect.Size();
   }
   else
   {
      // Determine the border size by asking windows to calculate the window rect
      // required for a client rect with a width and height of 0. This method will
      // work before the window is fully initialized and when the window is minimized.
      CRect rect;
      AdjustWindowRectEx(&rect, window.GetStyle(), FALSE, window.GetExStyle());
      return rect.Size();
   }
}


'MFC' 카테고리의 다른 글

PreTranslateMessage - Key  (0) 2013.11.25
PreTranslateMessage  (0) 2013.11.22
단일 문서에 뷰 여러 개 추가  (0) 2013.11.15
VS2008 핫키  (0) 2013.11.12
로그인 다이얼로그  (0) 2013.11.04
Posted by 곰돌이짱
,