MFC 中 Create…怎么释放?小弟我刚学MFC。不会用释放,求指点! 部分代码贴下

MFC 中 Create……如何释放?我刚学MFC。不会用释放,求指点! 部分代码贴上!
本帖最后由 VisualEleven 于 2012-09-03 11:58:25 编辑
 
CDC *pDC =GetDC();
BOOL bRegTriRet = m_rgnTri.CreatePolygonRgn( P, 3, ALTERNATE );//创建一个由一系列点围成的区域
 BOOL bRegRet = m_rgn.CreateRoundRectRgn(x0,y0,x1,y1,X3,Y3);
 m_rgnComb.CreateRectRgn( X1,y1,x2,y2);
int iRetComb = m_rgnComb.CombineRgn( &m_rgnTri, &m_rgn, RGN_OR );//将两个区域组合为一个新区域 
m_clrFrameColor = RGB(255, 255, 255);  //白色,填充
m_clrBkColor = RGB(0, 0, 0); //黑色,边
   CBrush pBrush;
   pBrush.CreateSolidBrush( m_clrFrameColor );//该函数创建一个具有指定颜色的逻辑刷子。 边
  
   CBrush pBrush1;
  pBrush1.CreateSolidBrush( m_clrBkColor );
   //填充
  pDC->FillRgn( &m_rgnComb, &pBrush );//填充
   pDC->FrameRgn( &m_rgnComb, &pBrush1, 1/*2*/, 1 );//边
  
   m_clrTextColor = RGB( 0, 0, 0 ); //黑色,字
   pDC->SetBkMode( TRANSPARENT );
   pDC->SetTextColor( m_clrTextColor );
   pDC->TextOut (ptTri[1].x+5,ptTri[1].y,str);

------解决方案--------------------
CDC *pDC  ReleaseDC()
CDC dc   DeleteDC()

其他都根据他生命周期自动释放吧
------解决方案--------------------
CreateDC :When you no longer need the DC, call the DeleteDC function. 
CreatePolygonRgn  :When you no longer need the HRGN object call the DeleteObject function to delete it. 
CreateRoundRectRgn  :  When you no longer need the HRGN object call the DeleteObject function to delete it. 
------------
这些问题,你都可以在MSDN上找到答案的,Good luck~