rt
解决方案 »
- directX截屏的问题
- !!!开源软件--VC6功能增强插件TabBars新版本发布,散分,散源码!!!
- 在开发流媒体时遇到一个不能解的问题,希望高手们都进来帮助一下.........
- 关于Serialize的数据读写的问题(在线)
- 请教: 如何改变另一行程的窗口属性?
- 实现定时屏幕抓取,若干次后发现如下问题
- 请叫大哥们:我在学VC,刚开始学,请问怎么学才能快一些,单位给时间叫我学习要求要快,不然我会被开除的,C++我只是懂一点,别人叫我先
- 有没用COM做window service,要求有和别的控件或程序通信的功能,不能用SOCKET?
- 高手请进,今天就给分
- 一定要帮帮我啊!!!如何用tagMsg结构中的WPARAM判断生成哪个键的WM_CHAR消息,
- 如何得到另一个程序里的。。当前鼠标的图标。。
- 怎样将IE设为只能上一个网站呀
// it in the view, and uses BitBlt to paint the bitmap bits.void CBlat2View::OnDraw(CDC* pDC)
{
CBlat2Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc); // Load IDB_BITMAP1 from the resources.
CBitmap bmp;
if (bmp.LoadBitmap(IDB_BITMAP1))
{
// Get the size of the bitmap.
BITMAP bmpInfo;
bmp.GetBitmap(&bmpInfo); // Create an in-memory device context compatible with the
// display device context that is used to paint.
CDC dcMemory;
dcMemory.CreateCompatibleDC(pDC); // Select the bitmap into the in-memory device context.
CBitmap* pOldBitmap = dcMemory.SelectObject(&bmp); // Find a center point for the bitmap in the client area.
CRect rect;
GetClientRect(&rect);
int nX = rect.left + (rect.Width() - bmpInfo.bmWidth) / 2;
int nY = rect.top + (rect.Height() - bmpInfo.bmHeight) / 2; // Copy the bits from the in-memory device context to the on-
// screen device context to do the painting. Use the computed center
// point for the target offset.
pDC->BitBlt(nX, nY, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory,
0, 0, SRCCOPY); dcMemory.SelectObject(pOldBitmap);
}
else
TRACE0("ERROR: Where is IDB_BITMAP1?\n");
}
if( m_bmp.m_hObject != NULL )
m_bmp.DeleteObject();
HBITMAP hbmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(),
"这里为文件的路径", IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION|LR_LOADFROMFILE);
if( hbmp == NULL )
return ;
m_bmp.Attach( hbmp );
CDC *dc=GetDC(); CDC memdc;
memdc.CreateCompatibleDC(dc); CBitmap* pOldBitmap =memdc.SelectObject( &m_bmp );
CWnd::DefWindowProc(WM_PAINT, (WPARAM)memdc.m_hDC , 0);
dc->BitBlt(rcclient.left, rcclient.top, rcclient.Width(), rcclient.Height(),
&memdc, 0, 0,SRCCOPY);
memdc.SelectObject(pOldBitmap); ReleaseDC(dc);