m_Rgn.DeleteObject();
VERIFY(m_Rgn.CreateRoundRectRgn(0,0,itemRect.right - itemRect.left,itemRect.bottom - itemRect.top,15,15));
SetWindowRgn(NULL,false) ;
CDC* pDC = CDC::FromHandle(lpDIS->hDC);
CRect itemRect = lpDIS->rcItem;
CBrush m_newBrush;
VERIFY(m_newBrush.CreateSolidBrush( m_colBoard ));  
VERIFY(pDC->FrameRgn( &m_Rgn , &m_newBrush , 1, 1 )); /ERIFY(pDC->FillRgn( &m_hrgn, &m_newBrush));
SetWindowRgn(m_Rgn, true);
这样执行没有问题
///////////////////////////
         m_Rgn.DeleteObject();
         VERIFY(m_Rgn.CreateRoundRectRgn(0,0,itemRect.right - itemRect.left,itemRect.bottom - itemRect.top,15,15));
SetWindowRgn(NULL,false) ;
         SetWindowRgn(m_Rgn, true);
CDC* pDC = CDC::FromHandle(lpDIS->hDC);
CRect itemRect = lpDIS->rcItem;

CBrush m_newBrush;
VERIFY(m_newBrush.CreateSolidBrush( m_colBoard ));  
VERIFY(pDC->FrameRgn( &m_Rgn , &m_newBrush , 1, 1 )); VERIFY(pDC->FillRgn( &m_hrgn, &m_newBrush));
执行FrameRgn或FillRgn就会出错
////////////////////////////////////////////////
也就是说SetWindowRgn的执行必须FrameRgn和FillRgn后

解决方案 »

  1.   

    After a successful call to SetWindowRgn, the system owns the region specified by the region handle hRgn. The system does not make a copy of the region. Thus, you should not make any further function calls with this region handle. In particular, do not delete this region handle. The system deletes the region handle when it no longer needed.这是MSDN里面SetWindowRgn的说明的部分!
    你的问题出在这儿!
      

  2.   

    SetWindowRgn(NULL,false) ; 你将窗口的区域设置为空了,