CXXX:OnTimer()
{
CBitmap Bitmap,*pOldBitmap;
Bitmap.LoadBitmap();
CDC* pDC=this->GetDC();
CDC memDC;
memDC.CreateCompatibleDC(pDC);
pOldBitmap=(CBitmap*)memDC.SelectObject(&Bitmap);
pDC->BitBlt(....,&memDC,....);
memDC.SelectObject(pOldBitmap);
memDC.DeleteObject(); }不想写了,太乱了,你找本书看一下。
{
CBitmap Bitmap,*pOldBitmap;
Bitmap.LoadBitmap();
CDC* pDC=this->GetDC();
CDC memDC;
memDC.CreateCompatibleDC(pDC);
pOldBitmap=(CBitmap*)memDC.SelectObject(&Bitmap);
pDC->BitBlt(....,&memDC,....);
memDC.SelectObject(pOldBitmap);
memDC.DeleteObject(); }不想写了,太乱了,你找本书看一下。
解决方案 »
- gina.dll如何调试
- 怎么设置文字显示的方向?TEXTOUT时想竖向显示(不限于TEXTOUT)函数。
- WideCharToMultiByte问题
- 如何把二个char *(ch1[4],ch2[8])类型的值给另一个char*(很容易,请大家帮忙。)
- 为什么我使用SAFEARRAY通过VB向VC程序传递字符串数组时总是不能成功啊?不知那位能够提供一份正确的代码?多谢了!
- 求教百位长度的整数乘法的实现算法
- 我想在这里多交朋友
- 要做一个3D效果的界面怎样开始?
- 有谁读过VC++ 6.0技术内幕第五版(Inside VC++ by David J. Kruglinski),评价一下好不好?
- 各位大侠,若不嫌小妹愚笨,就教教我,先谢了
- 请各位给点思路:如何检测出本机所连打印机的型号。谢谢!
- 怎么调用outlook并且把收信人地址和附件都设置好呢!(在线等待)
1.在OnInit...()中开一个Timer.(SetTimer(...))。
2.用一个成员变量CBitmap存你可画的图。
3.在OnDraw()中把CBitmap画到View上。
4.在OnTimer()中把CBitmap的图换一下。
m_hBitmap.LoadBitmap(IDB_BITMAP);
CDC* pDC=GetDC();
BITMAP bmpInfo;
m_hBitmap.GetBitmap(&bmpInfo); // Create an in-memory DC compatible with the
// display DC we're using to paint
CDC dcMemory;
dcMemory.CreateCompatibleDC(pDC); // Select the bitmap into the in-memory DC
CBitmap* pOldBitmap = dcMemory.SelectObject(&m_hBitmap); // Find a centerpoint for the bitmap in the client area
CRect rect1;
GetClientRect(&rect1);
int nX = rect1.left + (rect1.Width() - bmpInfo.bmWidth) / 2;
int nY = rect1.top + (rect1.Height() - bmpInfo.bmHeight) / 2; // Copy the bits from the in-memory DC into the on-
// screen DC to actually do the painting. Use the centerpoint
// we computed for the target offset.
pDC->BitBlt(nX, nY, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory,0, 0, SRCCOPY); dcMemory.SelectObject(pOldBitmap);*/