16,471
社区成员
发帖
与我相关
我的任务
分享
CBitmap cBmp;
cBmp.CreateCompatibleBitmap(this->GetDC(),32,32);
CBitmap *pOldBmp = this->GetDC()->SelectObject(&cBmp);
CRect rtClient,rtBtn;
GetClientRect(&rtClient); //获得对话框客户区屏幕坐标
ClientToScreen(&rtClient); //映射为屏幕坐标
//this->GetWindowRect(&rtClient); //这样也可以获得
m_image.GetWindowRect(&rtBtn); //获得button屏幕坐标
int dx=rtBtn.left-rtClient.left; //离左边边框的距离
int dy=rtBtn.top-rtClient.top; //离上边框的距离
m_ImageList.Draw(this->GetDC(),nItem,CPoint(dx,dy),ILD_NORMAL);
this->GetDC()->SetStretchBltMode(COLORONCOLOR);
this->GetDC()->StretchBlt(dx,dy,rtBtn.right-rtBtn.left,rtBtn.bottom-rtBtn.top,
this->GetDC(),dx,dy,30,30,SRCCOPY);