这段程序为什么没有反映呢
void CTransparentBltTestDlg::OnBnClickedButton3()
{
BITMAP bm;
mybmp.GetBitmap(&bm);
BITMAPINFO binfo;
ZeroMemory(&binfo,sizeof(BITMAPINFO));
binfo.bmiHeader.biBitCount=24; //file://24bit像素格式
binfo.bmiHeader.biCompression=0;
binfo.bmiHeader.biHeight=-bm.bmHeight;
binfo.bmiHeader.biPlanes=1;
binfo.bmiHeader.biSizeImage=0;
binfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
binfo.bmiHeader.biWidth=bm.bmWidth;
int nWidth = bm.bmWidth;
int nHeight = bm.bmHeight;
CClientDC dc(this);
BYTE *pbuf;//用来存储像素数据
int linebytes=(bm.bmWidth*3+3)&(~3);//4字节对齐
int size=linebytes*bm.bmHeight;
pbuf=new BYTE[size];
//MsgBox()
HBITMAP hOldImageBMP, hImageBMP = CreateCompatibleBitmap(dc.m_hDC,nWidth, nHeight); // 创建兼容位图
HDC hImageDC = CreateCompatibleDC(dc.m_hDC);
hOldImageBMP = (HBITMAP)SelectObject(hImageDC, hImageBMP);
CDC ImageDC;
ImageDC.CreateCompatibleDC(&dc);
COLORREF SetColor= RGB(0x00,0x00,0x00);
::GetDIBits(dc,hOldImageBMP,0,bm.bmHeight,pbuf,&binfo,SetColor);
SetColor = RGB(0xff,0x00,0x00);
::SetDIBits(dc,hOldImageBMP,0,bm.bmHeight,pbuf,&binfo,SetColor);
ImageDC.SelectObject(hOldImageBMP);
}
第一次写vc++程序,程序没有反映
请高手帮帮看看
我想实现将载入的位图中白色部门设为红色。可是程序没有反映
谢谢