AboutDlg.cpp
上传用户:jnfxs888
上传日期:2021-02-24
资源大小:98k
文件大小: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. m_EMailLink.SetAutoSize(TRUE);
  43. // Set HyperLink for Home Page
  44. m_HomePageLink.SetURL(_T(IDS_HOMEPAGEADDR));
  45. m_HomePageLink.SetUnderline(TRUE);
  46. m_HomePageLink.SetLinkCursor(AfxGetApp()->LoadCursor(IDC_HAND));
  47. m_HomePageLink.SetAutoSize(TRUE);
  48. SetLogoFont("Verdana", -25);
  49. // Write class version
  50. CString sVersion;
  51. sVersion.Format("CColorStaticST v%s", CColorStaticST::GetVersionC());
  52. GetDlgItem(IDC_VERSION)->SetWindowText(sVersion);
  53. // Fill friends listbox
  54. CListBox* lbxFriends;
  55. lbxFriends = (CListBox*)GetDlgItem(IDC_FRIENDS);
  56. return TRUE;
  57. }
  58. void CAboutDlg::SetLogoFont(CString Name, int nHeight, int nWeight, BYTE bItalic, BYTE bUnderline)
  59. {
  60.   if(m_fontLogo.m_hObject) m_fontLogo.Detach();
  61.   m_fontLogo.CreateFont(nHeight, 0, 0, 0, nWeight, bItalic, bUnderline,0,0,0,0,0,0, Name);
  62. } // End of SetLogoFont
  63. void CAboutDlg::OnPaint()
  64. {
  65.     CPaintDC dc(this); // device context for painting
  66.     CRect rectDlg;
  67.     GetWindowRect(rectDlg);
  68.     ScreenToClient(rectDlg);
  69.     CFont* OldFont = dc.SelectObject(&m_fontLogo);
  70.     CSize sizeText = dc.GetTextExtent(STSIGN, strlen(STSIGN));
  71.     dc.DrawState(CPoint((rectDlg.Width()-sizeText.cx)/2, 10), 
  72.                  rectDlg.Size(), 
  73.                  STSIGN, 
  74.                  DSS_DISABLED, TRUE, 0, (CBrush*)NULL);
  75.     dc.SelectObject(OldFont);
  76. } // End of OnPaint