如下代码效果上不起作用:
CDC *pdc=this->GetDC();
CRect rect;
GetClientRect(&rect);
CDC memDC;
memDC.CreateCompatibleDC(pdc);
memDC.FillRect(&rect,&CBrush(RGB(0,0,255)));
pdc->StretchBlt(0,0,rect.Width(),rect.Height(),&memDC,0,0,rect.Width(),rect.Height(),SRCCOPY);
memDC.DeleteDC();
ReleaseDC(pdc);
纠结中.....
求高手指点。
CDC *pdc=this->GetDC();
CRect rect;
GetClientRect(&rect);
CDC memDC;
memDC.CreateCompatibleDC(pdc);
memDC.FillRect(&rect,&CBrush(RGB(0,0,255)));
pdc->StretchBlt(0,0,rect.Width(),rect.Height(),&memDC,0,0,rect.Width(),rect.Height(),SRCCOPY);
memDC.DeleteDC();
ReleaseDC(pdc);
纠结中.....
求高手指点。
解决方案 »
- vs2005及其以上版本,release出来的程序运行不了
- 文件迁移问题?
- 当前进程的dll文件,却CFile open 函数出错,得到CFileException::11或者LastError 32
- 想学线程编程,从哪里学起,还有推荐下相关的学习资料。顶者有分.
- !!求助:请问如何在对话框中嵌入excel
- Hook其他程序中的StringGrid的内容 ,希望高手们来看看,我取得了别的程序的StringGrid地址,但是我在dll中引用的时候总出错
- win32 application中可不可以引用用MFC中的库,请指教
- 下面的问题是关于CRC的计算
- udp编程
- IPicture::Render如何翻转图片?
- OnTimer()没有响应
- CDC绘图填充颜色
否则memdc没有空的bmp
fill不了的。
CRect rect;
GetClientRect(&rect);
CBitmap Bitmap;CDC memDC;
memDC.CreateCompatibleDC(pdc);
Bitmap.CreateCompatibleBitmap(memDC, rect.iWidth, rect.iHeight);
memDC.SelectObject(Bitmap);
memDC.FillRect(&rect,&CBrush(RGB(0,0,255)));
pdc->StretchBlt(0,0,rect.Width(),rect.Height(),&memDC,0,0,rect.Width(),rect.Height(),SRCCOPY);
memDC.DeleteDC();
ReleaseDC(pdc);
GetClientRect(&rect);
CBitmap Bitmap;
CDC memDC;
memDC.CreateCompatibleDC(pdc);
Bitmap.CreateCompatibleBitmap(pdc, rect.Width(), rect.Height());
memDC.SelectObject(&Bitmap);
memDC.FillRect(&rect,&CBrush(RGB(0,0,255)));
pdc->StretchBlt(0,0,rect.Width(),rect.Height(),&memDC,0,0,rect.Width(),rect.Height(),SRCCOPY);
memDC.DeleteDC();
多谢!