转载请标明出处,原文地址:http://blog.csdn.net/morewindows/article/details/8696726
欢迎关注微博:http://weibo.com/MoreWindows
Windows界面编程之位图显示特效系列目录:
1. 《Windows界面编程第九篇位图显示特效交错效果》
http://blog.csdn.net/morewindows/article/details/8696720
2. 《Windows界面编程第十篇位图显示特效百叶窗效果》
http://blog.csdn.net/morewindows/article/details/8696722
3. 《Windows界面编程第十一篇位图显示特效随机积木效果》
http://blog.csdn.net/morewindows/article/details/8696724
4. 《Windows界面编程第十二篇位图显示特效飞入效果与伸展效果》
http://blog.csdn.net/morewindows/article/details/8696726
5. 《Windows界面编程第十三篇位图显示特效合集》
http://blog.csdn.net/morewindows/article/details/8696730
本篇《Windows界面编程第十二篇位图显示特效飞入效果与伸展效果》将讲解位图的飞入效果与伸展效果。飞入效果与伸展效果非常常见,在《Windows界面编程第六篇动画启动效果(动画效果显示及隐藏窗口)》(http://blog.csdn.net/morewindows/article/details/8656068)可以体验程序窗口在启动和退出的飞入动画效果与伸展动画效果。
从上往下的伸展效果(图片不能打开,请访问http://blog.csdn.net/morewindows/article/details/8696726)
从下往上的伸展效果(图片不能打开,请访问http://blog.csdn.net/morewindows/article/details/8696726)
从左往右的飞入效果(图片不能打开,请访问http://blog.csdn.net/morewindows/article/details/8696726)
从右往左的飞入效果(图片不能打开,请访问http://blog.csdn.net/morewindows/article/details/8696726)
在程序设计上,只要计算好显示坐标就可以了,直接给出代码:
// 飞入与伸展 - 从上往下//《Windows界面编程第十二篇 位图显示特效 飞入效果与伸展效果》//http://blog.csdn.net/morewindows/article/details/8696726void AnimateDraw_FlyingTopToBottom(HDC hdc, HDC hdcMem, int nWidth, int nHeight, UINT nIntervalTime = 2, BOOL bFade = TRUE){ int j; if (bFade) { for (j = 0; j <= nHeight; j++) { BitBlt(hdc, 0, 0, nWidth, j, hdcMem, 0, 0, SRCCOPY); Sleep(nIntervalTime); } } else { for (j = 0; j <= nHeight; j++) { BitBlt(hdc, 0, 0, nWidth, j, hdcMem, 0, nHeight - j, SRCCOPY); Sleep(nIntervalTime); } } BitBlt(hdc, 0, 0, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY);}// 飞入与伸展 - 从下往上//《Windows界面编程第十二篇 位图显示特效 飞入效果与伸展效果》//http://blog.csdn.net/morewindows/article/details/8696726void AnimateDraw_FlyingBottomToTop(HDC hdc, HDC hdcMem, int nWidth, int nHeight, UINT nIntervalTime = 2, BOOL bFade = TRUE){ int j; if (bFade) { for (j = nHeight; j >= 0; j--) { BitBlt(hdc, 0, j, nWidth, nHeight - j, hdcMem, 0, j, SRCCOPY); Sleep(nIntervalTime); } } else { for (j = nHeight; j >= 0; j--) { BitBlt(hdc, 0, j, nWidth, nHeight - j, hdcMem, 0, 0, SRCCOPY); Sleep(nIntervalTime); } } BitBlt(hdc, 0, 0, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY);}// 飞入与伸展 - 从左往右//《Windows界面编程第十二篇 位图显示特效 飞入效果与伸展效果》//http://blog.csdn.net/morewindows/article/details/8696726void AnimateDraw_FlyingLeftToRight(HDC hdc, HDC hdcMem, int nWidth, int nHeight, UINT nIntervalTime = 2, BOOL bFade = TRUE){ int i; if (bFade) { for (i = 0; i <= nWidth; i++) { BitBlt(hdc, 0, 0, i, nHeight, hdcMem, 0, 0, SRCCOPY); Sleep(nIntervalTime); } } else { for (i = 0; i <= nWidth; i++) { BitBlt(hdc, 0, 0, i, nHeight, hdcMem, nWidth - i, 0, SRCCOPY); Sleep(nIntervalTime); } } BitBlt(hdc, 0, 0, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY);}// 飞入与伸展 - 从右往左//《Windows界面编程第十二篇 位图显示特效 飞入效果与伸展效果》//http://blog.csdn.net/morewindows/article/details/8696726void AnimateDraw_FlyingRightToLeft(HDC hdc, HDC hdcMem, int nWidth, int nHeight, UINT nIntervalTime = 2, BOOL bFade = TRUE){ int i; if (bFade) { for (i = nWidth; i >= 0; i--) { BitBlt(hdc, i, 0, nWidth - i, nHeight, hdcMem, i, 0, SRCCOPY); Sleep(nIntervalTime); } } else { for (i = nWidth; i >= 0; i--) { BitBlt(hdc, i, 0, nWidth - i, nHeight, hdcMem, 0, 0, SRCCOPY); Sleep(nIntervalTime); } } BitBlt(hdc, 0, 0, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY);}
完整的程序在《Windows界面编程第十三篇位图显示特效合集》
http://blog.csdn.net/morewindows/article/details/8696730
转载请标明出处,原文地址:http://blog.csdn.net/morewindows/article/details/8696726
欢迎关注微博:http://weibo.com/MoreWindows
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow