AboutDlg.cpp
上传用户:pyhyhg
上传日期:2007-01-01
资源大小:191k
文件大小:3k
源码类别:

界面编程

开发平台:

Visual C++

  1. // AboutDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "AboutDlg.h"
  5. #ifdef _DEBUG
  6. #define new DEBUG_NEW
  7. #undef THIS_FILE
  8. static char THIS_FILE[] = __FILE__;
  9. #endif
  10. /////////////////////////////////////////////////////////////////////////////
  11. // CAboutDlg dialog
  12. CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/)
  13. : CDialog(CAboutDlg::IDD, pParent)
  14. {
  15. //{{AFX_DATA_INIT(CAboutDlg)
  16. // NOTE: the ClassWizard will add member initialization here
  17. //}}AFX_DATA_INIT
  18. }
  19. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  20. {
  21. CDialog::DoDataExchange(pDX);
  22. //{{AFX_DATA_MAP(CAboutDlg)
  23. // NOTE: the ClassWizard will add DDX and DDV calls here
  24. //}}AFX_DATA_MAP
  25. DDX_Control(pDX, IDC_EMAILLINK, m_EMailLink);
  26. DDX_Control(pDX, IDC_HOMEPAGELINK, m_HomePageLink);
  27. }
  28. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  29. //{{AFX_MSG_MAP(CAboutDlg)
  30. //}}AFX_MSG_MAP
  31. ON_WM_PAINT()
  32. END_MESSAGE_MAP()
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CAboutDlg message handlers
  35. BOOL CAboutDlg::OnInitDialog() 
  36. {
  37. CDialog::OnInitDialog();
  38. // Set HyperLink for E-Mail
  39. m_EMailLink.SetURL(_T(IDS_MAILADDR));
  40. m_EMailLink.SetUnderline(TRUE);
  41. m_EMailLink.SetLinkCursor(AfxGetApp()->LoadCursor(IDC_HAND));
  42. // Set HyperLink for Home Page
  43. m_HomePageLink.SetURL(_T(IDS_HOMEPAGEADDR));
  44. m_HomePageLink.SetUnderline(TRUE);
  45. m_HomePageLink.SetLinkCursor(AfxGetApp()->LoadCursor(IDC_HAND));
  46. SetLogoFont("Verdana", -25);
  47. // Write class version
  48. CString sVersion;
  49. sVersion.Format("CProgressST v%s", CProgressST::GetVersionC());
  50. GetDlgItem(IDC_VERSION)->SetWindowText(sVersion);
  51. // Fill friends listbox
  52. m_lbxFriends.SubclassDlgItem(IDC_FRIENDS, this);
  53. m_lbxFriends.AddString("Chris Maunder <Chris.Maunder@cbr.clw.csiro.au>");
  54. return TRUE;
  55. }
  56. void CAboutDlg::SetLogoFont(CString Name, int nHeight, int nWeight, BYTE bItalic, BYTE bUnderline)
  57. {
  58.   if(m_fontLogo.m_hObject) m_fontLogo.Detach();
  59.   m_fontLogo.CreateFont(nHeight, 0, 0, 0, nWeight, bItalic, bUnderline,0,0,0,0,0,0, Name);
  60. } // End of SetLogoFont
  61. void CAboutDlg::OnPaint()
  62. {
  63.     CPaintDC dc(this); // device context for painting
  64.     CRect rectDlg;
  65.     GetWindowRect(rectDlg);
  66.     ScreenToClient(rectDlg);
  67.     CFont* OldFont = dc.SelectObject(&m_fontLogo);
  68.     CSize sizeText = dc.GetTextExtent(STSIGN, strlen(STSIGN));
  69.     dc.DrawState(CPoint((rectDlg.Width()-sizeText.cx)/2, 10), 
  70.                  rectDlg.Size(), 
  71.                  STSIGN, 
  72.                  DSS_DISABLED, TRUE, 0, (CBrush*)NULL);
  73.     dc.SelectObject(OldFont);
  74. } // End of OnPaint