设为首页 加入收藏

TOP

17.9.3 电子相册浏览模块的设计与实现(10)
2013-10-07 14:40:00 来源: 作者: 【 】 浏览:63
Tags:17.9.3 电子相册 浏览 模块 设计 实现

17.9.3  电子相册浏览模块的设计与实现(10)

代码实现如下:

  1. 01  else if(m_turnType == type_left || m_turnType == type_end)  
  2. 02  {         
  3. 03      for( int i = 0;  i < 4; i++)  
  4. 04      {   //载入4张相册页面  
  5. 05            
  6. 06          len = MultiByteToWideChar(CP_ACP, 0,  
  7. 07                                  (LPCTSTR)m_strPage[i], -1, NULL, 0);  
  8. 08          wPage = new wchar_t[len];  
  9. 09          MultiByteToWideChar(CP_ACP, 0,  
  10. 10                              (LPCTSTR)m_strPage[i], -1, wPage, len);   
  11. 11          m_pPage[i] = Bitmap::FromFile(wPage);   
  12. 12          delete []wPage;  
  13. 13      }   //载入页面1中的相片  
  14. 14      len = MultiByteToWideChar(CP_ACP, 0,  
  15. 15                           (LPCTSTR)m_strImage[m_curNum -1 - 2],  
  16. 16                              -1, NULL, 0);  
  17. 17      wImage = new wchar_t[len];  
  18. 18      MultiByteToWideChar(CP_ACP, 0,  
  19. 19                          (LPCTSTR)m_strImage[m_curNum - 1 - 2], -1, wImage,  
  20. 20                          len);               //第n-3张  
  21. 21      m_pImage[0] = Image::FromFile(wImage);  
  22. 22      delete []wImage;  
  23. 23      //载入页面2中的相片  
  24. 24      len = MultiByteToWideChar(CP_ACP, 0,  
  25. 25                          (LPCTSTR)m_strImage[m_curNum  - 2],  
  26. 26                           -1, NULL, 0);  
  27. 27      wImage = new wchar_t[len];  
  28. 28      MultiByteToWideChar(CP_ACP, 0,  
  29. 29                       (LPCTSTR)m_strImage[m_curNum  - 2],  
  30. 30                       -1, wImage, len);   
  31. 31      m_pImage[1] = Image::FromFile(wImage);  //第n-2张  
  32. 32      delete []wImage;  
  33. 33      //载入页面3中的相片  
  34. 34      len = MultiByteToWideChar(CP_ACP, 0,  
  35. 35                           (LPCTSTR)m_strImage[m_curNum -3 - 2],  
  36. 36                           -1, NULL, 0);  
  37. 37      wImage = new wchar_t[len];  
  38. 38      MultiByteToWideChar(CP_ACP, 0,  
  39. 39                           (LPCTSTR)m_strImage[m_curNum -3 - 2],  
  40. 40                           -1, wImage, len);  //第n-5张  
  41. 41      m_pImage[2] = Image::FromFile(wImage);  
  42. 42      delete []wImage;  
  43. 43      //载入页面4中的相片  
  44. 44      len = MultiByteToWideChar(CP_ACP, 0,  
  45. 45                           (LPCTSTR)m_strImage[m_curNum -2 - 2],  
  46. 46                           -1, NULL, 0);  
  47. 47      wImage = new wchar_t[len];  
  48. 48      MultiByteToWideChar(CP_ACP, 0,  
  49. 49                       (LPCTSTR)m_strImage[m_curNum -2 - 2],  
  50. 50                       -1, wImage, len);  //第n-4张  
  51. 51      m_pImage[3] = Image::FromFile(wImage);  
  52. 52      delete []wImage;  
  53. 53      //定义4个页面的Graphics型变量  
  54. 54      for(i = 0;  i < 4; i++)  
  55. 55      {  
  56. 56          m_pGPage[i] = Graphics::FromImage(m_pPage[i]);  
  57. 57      }  
  58. 58      //判断是否到达封面  
  59. 59      if(m_curNum <= 3)  
  60. 60      {  
  61. 61          m_turnType = type_leftTohead;  
  62. 62          m_curNum = -2;  
  63. 63      }  
  64. 64      else  
  65. 65      {     
  66. 66          m_curNum -2;              //前移  
  67. 67      }  
  68. 68  }  

【代码解析】

由代码结合图像可以看出,虽然同右翻页的原理相同,但是由于顺序有变,赋值方式也就有了区别。


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇17.1.3 相册浏览模块 下一篇17.9.3 电子相册浏览模块的设计与..

评论

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