Windows介面編程第十二篇 位元影像顯示特效 飛入效果與伸展效果

來源:互聯網
上載者:User

轉載請標明出處,原文地址: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

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.