圆角窗口的实现

 

void UiMainFrm::OnSize(UINT nType, int cx, int cy)
{
  CWnd::OnSize(nType, cx, cy);

  CRgn rgn;   CRect rcRgn;   GetWindowRect(&rcRgn);   rcRgn -=rcRgn.TopLeft();   CPoint points[8] = {CPoint(rcRgn.left, m_nBorderWidth), CPoint(m_nBorderWidth, rcRgn.top),   CPoint(rcRgn.right-m_nBorderWidth, rcRgn.top), CPoint(rcRgn.right, m_nBorderWidth),   CPoint(rcRgn.right, rcRgn.bottom-m_nBorderWidth-1), CPoint(rcRgn.right-m_nBorderWidth-1, rcRgn.bottom),   CPoint(m_nBorderWidth+1, rcRgn.bottom), CPoint(rcRgn.left, rcRgn.bottom-m_nBorderWidth-1)};   int nPolyCounts[1] = {8};   int nRet = rgn.CreatePolyPolygonRgn(points, nPolyCounts, 1, WINDING);   //int nRet = rgn.CreateRoundRectRgn( re.left, re.top,re.right+1,re.bottom+1,5 ,5);   SetWindowRgn( rgn, TRUE );   DeleteObject(rgn); }

 

posted @ 2013-09-15 13:08  幸福之圣  阅读(271)  评论(0)    收藏  举报