设为首页 加入收藏

TOP

VC只用GDI实现位图展现简单特效(三)
2014-11-23 17:31:26 来源: 作者: 【 】 浏览:32
Tags:VC只用 GDI 实现 位图 展现 简单 特效
dHeight; float x, y; int lastX = 0, lastY = 0, lastWidth = 0, lastHeight = 0; dcMem.CreateCompatibleDC(pDC); bmp.GetBitmap(&bm); oldWidth = bm.bmWidth; oldHeight = bm.bmHeight; CRect rcWnd; pMainDlg->GetWindowRect(&rcWnd); CBitmap bmpBkgd; CDC dcBkgd; dcBkgd.CreateCompatibleDC(pDC); bmpBkgd.CreateCompatibleBitmap(pDC, rcWnd.Width() + 200, rcWnd.Height() + 200); dcBkgd.SelectObject(&bmpBkgd); dcBkgd.FillSolidRect(0, 0, rcWnd.Width() + 200, rcWnd.Height() + 200, RGB(255, 174 ,201)); while (1) { if (base <= oldWidth) { base += 15; } if (base > oldWidth && degree == 0) { break; } width = base; height = base * ((float)oldHeight / (float)oldWidth); hBmp = GetRotatedBitmap((HBITMAP)bmp.GetSafeHandle(), RADIAN(degree), (int)width, (int)height, RGB(255, 174 ,201)); pbmpRotated = CBitmap::FromHandle(hBmp); dcMem.SelectObject(pbmpRotated); pbmpRotated->GetBitmap(&bm); x = (float)oldWidth / 2 - (float)bm.bmWidth / 2; y = (float)oldHeight / 2 - (float)bm.bmHeight / 2; pDC->BitBlt(lastX, lastY, lastWidth, lastHeight, &dcBkgd, 0, 0, SRCCOPY); pDC->BitBlt((int)x, (int)y, bm.bmWidth, bm.bmHeight, &dcMem, 0, 0, SRCCOPY); lastX = (int)x; lastY = (int)y; lastWidth = bm.bmWidth; lastHeight = bm.bmHeight; pbmpRotated->DeleteObject(); degree = (degree += 15) > 360 0 : degree; Sleep(1); } dcMem.DeleteDC(); dcBkgd.DeleteDC(); bmpBkgd.DeleteObject(); EnumChildWindows(pMainDlg->GetSafeHwnd(), EnumChildProc, 1L); // CLEAN_CODE return 0; }

首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇VC版超级记事本 下一篇VC版八皇后

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: