⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loadbitmap.cpp

📁 这是一个连连看的游戏源程序
💻 CPP
字号:
void CTestbitmap2View::OnDraw(CDC* pDC) 
{
	// TODO: Add your specialized code here and/or call the base class

	
	CBitmap bmp;
	if (bmp.LoadBitmap(IDB_BITMAP2))
	{
		BITMAP bmpInfo;
		bmp.GetBitmap(&bmpInfo);
		
		CDC dcMemory;
		dcMemory.CreateCompatibleDC(pDC);
		
		CBitmap* pOldBitmap = dcMemory.SelectObject(&bmp);
		
		CRect rect;
		GetClientRect(&rect);
		int nX = rect.left + (rect.Width() - bmpInfo.bmWidth) / 2;
		int nY = rect.top + (rect.Height() - bmpInfo.bmHeight) / 2;
		
		pDC->BitBlt(nX, nY, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory, 
			0, 0, SRCCOPY);
		
		dcMemory.SelectObject(pOldBitmap);
	}
	else
		TRACE("ERROR: Can not load bitmap!");
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -