CRgn myrgn;
myrgn.CreatePolygonRgn(LPpoint lpPoint,int nCount,int nMode)
lppoint 为一CPoint 型的数组,nCount为数组元素个数,nMode为该区域的填充模式

解决方案 »

  1.   

    to fyougo(莱斯洛特):
      关键是如何得到回复人:lppoint .
      

  2.   

    是显是的到每一点的颜色,如果是我要的就rgnTemp.CreateRectRgn(x, y, x+1, y+1);
    wndRgn.CombineRgn(&wndRgn, &rgnTemp, RGN_XOR);不要就不做;
             GetWindowRect(&cRect);
    CPoint ptOrg=cRect.TopLeft(); BITMAP bmInfo;
    cBitmap.GetObject(sizeof(bmInfo),&bmInfo);
    CRect rcNewWnd=CRect(ptOrg,CSize(bmInfo.bmWidth,bmInfo.bmHeight)); memDC.CreateCompatibleDC(pDC);
    pOldMemBmp = memDC.SelectObject(&cBitmap);
    colMask=memDC.GetPixel(0,0); wndRgn.CreateRectRgn(0, 0, rcNewWnd.Width(), rcNewWnd.Height());
    for(x=0; x<=rcNewWnd.Width(); x++)
    {
    for(y=0; y<=rcNewWnd.Height(); y++)
    {
    col = memDC.GetPixel(x, y);
    if(col == colMask)
    {
    rgnTemp.CreateRectRgn(x, y, x+1, y+1);
    wndRgn.CombineRgn(&wndRgn, &rgnTemp, RGN_XOR);
    rgnTemp.DeleteObject();
    }
    }
    }
    if (pOldMemBmp) memDC.SelectObject(pOldMemBmp);