AboutMember.cpp
上传用户:yatsl7111
上传日期:2007-01-08
资源大小:1433k
文件大小:4k
源码类别:

图形图象

开发平台:

Visual C++

  1. // AboutMember.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "iseeexplorer.h"
  5. #include "AboutMember.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. static TCHAR titleimagepath[] = _T(".\title.tga");
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CAboutMember
  14. CAboutMember::CAboutMember()
  15. {
  16. m_hDrawDib = DrawDibOpen();
  17. CAboutMember::RegisterWndClass(AfxGetInstanceHandle());
  18. m_pImage = ISeeGetIRWEngine()->LoadImageFromFile((LPCTSTR)titleimagepath);
  19. infofont.CreatePointFont(90, _T("宋体"));
  20. infonum  = ISeeGetIRWEngine()->GetDeveloperInfo(&lpInfo);
  21. m_timer = FALSE;
  22. m_count = 0;
  23. }
  24. CAboutMember::~CAboutMember()
  25. {
  26. if (m_pImage)
  27. delete m_pImage;
  28. if(m_hDrawDib)
  29. DrawDibClose(m_hDrawDib);
  30. if (infonum)
  31. ::GlobalFree(lpInfo);
  32. }
  33. BEGIN_MESSAGE_MAP(CAboutMember, CStatic)
  34. //{{AFX_MSG_MAP(CAboutMember)
  35. ON_WM_ERASEBKGND()
  36. ON_WM_PAINT()
  37. ON_WM_TIMER()
  38. ON_WM_DESTROY()
  39. //}}AFX_MSG_MAP
  40. END_MESSAGE_MAP()
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CAboutMember message handlers
  43. BOOL CAboutMember::OnEraseBkgnd(CDC* pDC) 
  44. {
  45. CRect rect;
  46. GetClientRect(rect);
  47. pDC->FillSolidRect(rect, (COLORREF)RGB(255,255,255));
  48. return TRUE;
  49. }
  50. void CAboutMember::OnPaint() 
  51. {
  52. CPaintDC dc(this); // device context for painting
  53. int i, start;
  54. CRect rect;
  55. GetClientRect(rect);
  56. while (m_pImage->GetResult() == IRWERRT_ING);
  57. if ((m_pImage)&&(m_pImage->GetDataPackState() >= PKST_PASSINFO))
  58. {
  59. if (lpInfo)
  60. {
  61. CFont *pOldFont = dc.SelectObject(&infofont);
  62. CRect rtmp;
  63. start = rect.bottom-m_count;
  64. for (i=0;i<infonum;i++)
  65. {
  66. rtmp.SetRect(rect.left+10, start+i*80, rect.right-10, start+i*80+16);
  67. dc.DrawText((LPCTSTR)lpInfo[i].modulename, -1, rtmp, DT_SINGLELINE|DT_NOCLIP|DT_RIGHT|DT_VCENTER);
  68. rtmp.SetRect(rect.left+10, start+i*80+16, rect.right-10, start+i*80+32);
  69. dc.DrawText((LPCTSTR)lpInfo[i].author, -1, rtmp, DT_SINGLELINE|DT_NOCLIP|DT_RIGHT|DT_VCENTER);
  70. rtmp.SetRect(rect.left+10, start+i*80+32, rect.right-10, start+i*80+48);
  71. dc.DrawText((LPCTSTR)lpInfo[i].EMail, -1, rtmp, DT_SINGLELINE|DT_NOCLIP|DT_RIGHT|DT_VCENTER);
  72. rtmp.SetRect(rect.left+10, start+i*80+48, rect.right-10, start+i*80+64);
  73. dc.DrawText((LPCTSTR)lpInfo[i].messages, -1, rtmp, DT_SINGLELINE|DT_NOCLIP|DT_RIGHT|DT_VCENTER);
  74. }
  75. if ((start+i*80) < rect.bottom)
  76. m_count = -48;
  77. dc.SelectObject(pOldFont);
  78. }
  79. CRect imgrect(0, 0, m_pImage->GetImageWidth(), m_pImage->GetImageHeight());
  80. DrawDibDraw(m_hDrawDib, dc.GetSafeHdc(), 0, 0, 
  81. imgrect.Width(), imgrect.Height(),
  82. (LPBITMAPINFOHEADER)(m_pImage->GetImageBitmapInfo()), 
  83. (LPVOID)(m_pImage->GetImageBitData()), 
  84. 0, 0, imgrect.Width(), imgrect.Height(),
  85. DDF_HALFTONE);
  86. }
  87. }
  88. int CAboutMember::InitControl()
  89. {
  90. m_timer = SetTimer(1, 60, NULL);
  91. return 0;
  92. }
  93. void CAboutMember::OnTimer(UINT nIDEvent) 
  94. {
  95. m_count++;
  96. CRect rect;
  97. GetClientRect(rect);
  98. rect.top = m_pImage->GetImageHeight();
  99. ScrollWindow(0, -1, rect);
  100. UpdateWindow();
  101. CStatic::OnTimer(nIDEvent);
  102. }
  103. void CAboutMember::OnDestroy() 
  104. {
  105. if (m_timer)
  106. KillTimer(m_timer);
  107. CStatic::OnDestroy();
  108. }
  109. BOOL CAboutMember::RegisterWndClass(HINSTANCE hInstance)
  110. {
  111. WNDCLASS wc;
  112. wc.lpszClassName = "ISEE_ABOUTMEMBER"; // matches class name in client
  113. wc.hInstance = hInstance;
  114. wc.lpfnWndProc = ::DefWindowProc;
  115. wc.hCursor = ::LoadCursor(NULL, IDC_ARROW);
  116. wc.hIcon = 0;
  117. wc.lpszMenuName = NULL;
  118. wc.hbrBackground = (HBRUSH) ::GetStockObject(LTGRAY_BRUSH);
  119. wc.style = CS_GLOBALCLASS; // To be modified
  120. wc.cbClsExtra = 0;
  121. wc.cbWndExtra = 0;
  122. return (::RegisterClass(&wc) != 0);
  123. }