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

Static控件

开发平台:

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("CDigitST v%s", CDigitST::GetVersionC());
  50. GetDlgItem(IDC_VERSION)->SetWindowText(sVersion);
  51. // Fill friends listbox
  52. m_lbxFriends.SubclassDlgItem(IDC_FRIENDS, this);
  53. return TRUE;
  54. }
  55. void CAboutDlg::SetLogoFont(CString Name, int nHeight, int nWeight, BYTE bItalic, BYTE bUnderline)
  56. {
  57.   if(m_fontLogo.m_hObject) m_fontLogo.Detach();
  58.   m_fontLogo.CreateFont(nHeight, 0, 0, 0, nWeight, bItalic, bUnderline,0,0,0,0,0,0, Name);
  59. } // End of SetLogoFont
  60. void CAboutDlg::OnPaint()
  61. {
  62.     CPaintDC dc(this); // device context for painting
  63.     CRect rectDlg;
  64.     GetWindowRect(rectDlg);
  65.     ScreenToClient(rectDlg);
  66.     CFont* OldFont = dc.SelectObject(&m_fontLogo);
  67.     CSize sizeText = dc.GetTextExtent(STSIGN, strlen(STSIGN));
  68.     dc.DrawState(CPoint((rectDlg.Width()-sizeText.cx)/2, 10), 
  69.                  rectDlg.Size(), 
  70.                  STSIGN, 
  71.                  DSS_DISABLED, TRUE, 0, (CBrush*)NULL);
  72.     dc.SelectObject(OldFont);
  73. } // End of OnPaint