AboutDlg.cpp
上传用户:wangfu1106
上传日期:2014-08-20
资源大小:193k
文件大小:3k
源码类别:

数据库编程

开发平台:

Visual C++

  1. // AboutDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "MySQL.h"
  5. #include "AboutDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CAboutDlg dialog
  13. CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/)
  14. : CDialog(CAboutDlg::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CAboutDlg)
  17. m_bMuch=false;
  18. //}}AFX_DATA_INIT
  19. }
  20. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  21. {
  22. CDialog::DoDataExchange(pDX);
  23. //{{AFX_DATA_MAP(CAboutDlg)
  24. DDX_Control(pDX, IDOK, m_cOk);
  25. DDX_Control(pDX, IDC_MORE, m_cMore);
  26. DDX_Control(pDX, IDC_EMAIL, m_cEmail);
  27. DDX_Control(pDX, IDC_INFO, m_cInfo);
  28. //}}AFX_DATA_MAP
  29. }
  30. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  31. //{{AFX_MSG_MAP(CAboutDlg)
  32. ON_BN_CLICKED(IDC_MORE, OnMore)
  33. //}}AFX_MSG_MAP
  34. END_MESSAGE_MAP()
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CAboutDlg message handlers
  37. BOOL CAboutDlg::OnInitDialog() 
  38. {
  39. CDialog::OnInitDialog();
  40. // TODO: Add extra initialization here
  41. m_cEmail.SetURL("mailto:Friendlysoft@Hotmail.com");
  42. m_cEmail.SetUnderline(TRUE);
  43. TCHAR* pInfo=
  44. {_T(
  45. "MySQL 连接演示程序(VC版)t|"
  46. "  版本号:    1.0.0  n||"
  47. "  软件作者  t|"
  48. "  Friendlysoft||"
  49. "  技术在于精  t|"
  50. "  卓越在于新  t||"
  51. "如发现BUG,请与我联系:t|"
  52. "Friendlysoft@163.com|"
  53. "Friendlysoft@sina.com|"
  54. "Friendlysoft@Hotmail.com||"
  55. )};
  56. m_cInfo.SubclassDlgItem(IDD_ABOUTDLG,this);
  57. m_cInfo.SetCredits(pInfo);
  58. m_cInfo.SetSpeed(1);
  59. m_cInfo.SetColor(BACKGROUND_COLOR,RGB(0,255,200));
  60. m_cInfo.SetTransparent();
  61. m_cInfo.SetGradient(GRADIENT_RIGHT_DARK);
  62. int x,y,high,width;
  63. RECT wndrect,deskrect;
  64. GetWindowRect(&wndrect);
  65. high=wndrect.bottom-wndrect.top;
  66. width=wndrect.right-wndrect.left;
  67. GetDesktopWindow()->GetWindowRect(&deskrect);
  68. x=(deskrect.right-width)/2;
  69. y=(deskrect.bottom-high)/2;
  70. deskrect.left=x;
  71. deskrect.right=deskrect.left+width;
  72. deskrect.top=y;
  73. deskrect.bottom=deskrect.top+high;
  74. CWnd* wnd=GetDlgItem(IDC_INFO);
  75. wnd->GetWindowRect(&wndrect);
  76. high=wndrect.bottom-wndrect.top;
  77. deskrect.bottom-=high+10;
  78. MoveWindow(&deskrect);
  79. InitCover();
  80. return TRUE;  // return TRUE unless you set the focus to a control
  81.               // EXCEPTION: OCX Property Pages should return FALSE
  82. }
  83. void CAboutDlg::InitCover()
  84. {
  85. m_cOk.SetIcon(IDI_OK);
  86. m_cOk.SetBtnCursor(IDC_HANDCUR);
  87. m_cMore.SetIcon(IDI_MORE_R);
  88. m_cMore.SetBtnCursor(IDC_HANDCUR);
  89. return;
  90. }
  91. void CAboutDlg::OnMore() 
  92. {
  93. // TODO: Add your control notification handler code here
  94. if(!m_bMuch)
  95. {
  96. int i,high;
  97. RECT rect,wndrect;
  98. GetWindowRect(&wndrect);
  99. CWnd* wnd=GetDlgItem(IDC_INFO);
  100. wnd->GetWindowRect(&rect);
  101. high=rect.bottom-rect.top;
  102. for(i=0;i<high+5;wndrect.bottom++)
  103. {
  104. MoveWindow(&wndrect);
  105. i++;
  106. }
  107. m_cInfo.StartScrolling();
  108. m_cMore.SetWindowText("隐藏");
  109. m_cMore.SetIcon(IDI_MORE_L);
  110. m_bMuch=!m_bMuch;
  111. }
  112. else
  113. {
  114. int i,high;
  115. RECT rect,wndrect;
  116. GetWindowRect(&wndrect);
  117. CWnd* wnd=GetDlgItem(IDC_INFO);
  118. wnd->GetWindowRect(&rect);
  119. high=rect.bottom-rect.top;
  120. for(i=0;i<high+5;wndrect.bottom-=2)
  121. {
  122. MoveWindow(&wndrect);
  123. Sleep(1);
  124. i+=2;
  125. }
  126. m_cInfo.EndScrolling();
  127. m_cMore.SetWindowText("更多");
  128. m_cMore.SetIcon(IDI_MORE_R);
  129. m_bMuch=!m_bMuch;
  130. }
  131. }