OnPaint方法
//创建内存DC
CDC *pDC = GetDC();
CDC memDC;
memDC.CreateCompatibleDC(pDC);
//获取新窗体形状(通过bmp文件)
CBitmap bitmap;
bitmap.LoadBitmapW(IDB_BITMAP_BK);
memDC.SelectObject(&bitmap);
//获取原始窗体大小
CRect rc;
CRgn rgn;
GetWindowRect(&rc);
//设置新窗体背景色
rgn.CreateRectRgn(0,0,rc.Width(),rc.Height());
for(int x=0;x<=rc.Width();x++)
{
for(int y=0;y<=rc.Height();y++)
{
COLORREF col = memDC.GetPixel(x,y);
if(col==RGB(255,255,255))
{
CRgn tmp;
tmp.CreateRectRgn(x,y,x+1,y+1);
rgn.CombineRgn(&rgn,&tmp,RGN_XOR);
tmp.DeleteObject();
}
}
}
SetWindowRgn((HRGN)rgn,TRUE);