CreditDialog.cpp
上传用户:zhenlu1001
上传日期:2007-01-02
资源大小:131k
文件大小:3k
源码类别:

Static控件

开发平台:

Visual C++

  1. // CreditDialog.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CreditsTest.h"
  5. #include "CreditDialog.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. static BOOL bClicked = FALSE;
  12. char *pArrCredit = { "|NETBAS FOR WINDOWS NTt||Copyright (c) 1998|"
  13.         "Test Data AS|All Rights Reserved||"
  14.         "BITMAP1^||"    // this is a quoted bitmap resource 
  15.         "Project Leadr||Kjetil Kvamme|||"
  16.         "Technical Leadr||Paul K. Tonder|||"
  17.         "Engineering Leadr||Paul K. Tonder|||"
  18.         "Product Leadr||Tom Rotting|||"
  19.         "Engineeringr||Paul K. Tonder,  Rolf T. Wold,  Sigbjorn Helset|"
  20.         "Reidar Ognedal,  Kjetil Kvamme, Arne Bakken|||"
  21.         "BITMAP2^|||"  // this is a quoted bitmap resource 
  22.         "QAr||Mary Hech,  Sam Bamnm,  Ron Fonn,  Steve Waeve|"
  23.         "Igor Borisnoff,  FellaB |||"
  24.         "Documentationr||"
  25.         "Arvid Molnvik,  Joanne Hone,  Annette Fune|||"
  26.         "Technical Program Officer||Burf Murphy, Foll Roller||||"
  27.         "Systems Supportr||Bendy Land|||"
  28.         "Administrative Supportr||Donna Fonna|||"
  29.         "* * * * * * * * *t|||"
  30.         "BITMAP3^||"
  31.         "Project Managerr||Dwain Kinghorn|||"
  32.         "Engineeringr||"
  33.         "Hank Bank,  Ray Fay,  Bill Sill,  Mark Dark,  Peter Leter|"
  34.         "Lev Bef|||Quality Assurancer||"
  35.         "Biff Bin||||"
  36.         "BITMAP4^|||||"
  37.         };
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CCreditDialog dialog
  40. CCreditDialog::CCreditDialog(CWnd* pParent /*=NULL*/)
  41. : CDialog(CCreditDialog::IDD, pParent)
  42. {
  43. //{{AFX_DATA_INIT(CCreditDialog)
  44. // NOTE: the ClassWizard will add member initialization here
  45. //}}AFX_DATA_INIT
  46. bitmapIDs[0] = IDB_BITMAP1;
  47. bitmapIDs[1] = IDB_BITMAP2;
  48. }
  49. void CCreditDialog::DoDataExchange(CDataExchange* pDX)
  50. {
  51. CDialog::DoDataExchange(pDX);
  52. //{{AFX_DATA_MAP(CCreditDialog)
  53. // NOTE: the ClassWizard will add DDX and DDV calls here
  54. //}}AFX_DATA_MAP
  55. }
  56. BEGIN_MESSAGE_MAP(CCreditDialog, CDialog)
  57. //{{AFX_MSG_MAP(CCreditDialog)
  58. ON_WM_TIMER()
  59. ON_WM_DESTROY()
  60. //}}AFX_MSG_MAP
  61. END_MESSAGE_MAP()
  62. /////////////////////////////////////////////////////////////////////////////
  63. // CCreditDialog message handlers
  64. #define  DISPLAY_TIMER_ID 151
  65. BOOL CCreditDialog::OnInitDialog() 
  66. {
  67. CDialog::OnInitDialog();
  68. m_static.SubclassDlgItem(IDC_DISPLAY_STATIC,this);
  69. m_static.SetCredits(pArrCredit,'|');
  70. m_static.SetSpeed(DISPLAY_FAST);
  71. m_static.SetColor(BACKGROUND_COLOR, RGB(0,0,255));
  72. m_static.SetTransparent();
  73. // m_static.SetGradient(GRADIENT_RIGHT_DARK);
  74. m_static.SetBkImage(bitmapIDs[0]);
  75. m_static.StartScrolling();
  76. TimerOn = SetTimer(DISPLAY_TIMER_ID,5000,NULL);
  77.     ASSERT(TimerOn != 0);
  78. return TRUE;  // return TRUE unless you set the focus to a control
  79.               // EXCEPTION: OCX Property Pages should return FALSE
  80. }
  81. void CCreditDialog::OnTimer(UINT nIDEvent) 
  82. {
  83. if (nIDEvent != DISPLAY_TIMER_ID)
  84. {
  85. CDialog::OnTimer(nIDEvent);
  86. return;
  87. }
  88. static int index = 0;
  89. index = ++index % 2;
  90. m_static.SetBkImage(bitmapIDs[index]);
  91. CDialog::OnTimer(nIDEvent);
  92. }
  93. void CCreditDialog::OnDestroy() 
  94. {
  95. CDialog::OnDestroy();
  96. if(TimerOn)
  97. ASSERT(KillTimer(DISPLAY_TIMER_ID));
  98. }