现在的位置: 首页 > 综合 > 正文

双缓冲gdi+旋转图像固定角度

2018年10月15日 ⁄ 综合 ⁄ 共 762字 ⁄ 字号 评论关闭
HDC hdc= m_PaintManager.GetPaintDC();
	HDC hMemDC = ::CreateCompatibleDC(hdc);
	HBITMAP hMemBitmap = ::CreateCompatibleBitmap(hdc, 347, 217);
	::SelectObject(hMemDC, hMemBitmap);
	RECT myRect;
	myRect.left = 0;
	myRect.top = 0;
	myRect.right = 347;
	myRect.bottom = 217;
	::FillRect(hMemDC, &myRect, m_hBrushBackground);	
	RECT SrcRect = m_pCompassVer->GetPos();
	Matrix matric(1,0,0,1,myRect.left, myRect.top);		
	
	Graphics      gp(hMemDC);
	gp.DrawImage(m_pImageCompass,myRect.left, myRect.top, m_pImageCompass->GetWidth(), m_pImageCompass->GetHeight());	
	matric.RotateAt(-180 + angle, m_PtCenter);

	gp.SetTransform(&matric);
	gp.DrawImage(m_pImageFinger, 160,170,114,30);
	gp.ReleaseHDC(m_PaintManager.GetPaintDC());
	angle +=2;
	::BitBlt(hdc,SrcRect.left, SrcRect.top, 347, 217, hMemDC, 0, 0, SRCCOPY);
	::DeleteObject(hMemBitmap);
	::DeleteDC(hMemDC);

抱歉!评论已关闭.