AboutDlg.cpp
上传用户:gzboli
上传日期:2013-04-10
资源大小:471k
文件大小: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. // Create OK button
  39. m_btnOk.SubclassDlgItem(IDOK, this);
  40. m_btnOk.SetIcon(IDI_OKAC);
  41. m_btnOk.SetBtnCursor(IDC_GREEN);
  42. // Set HyperLink for E-Mail
  43. // m_EMailLink.SetURL((char*)_T(IDS_MAILADDR));
  44. m_EMailLink.SetURL(_T("MailTo:YuTao_tj@sina.com"));
  45. m_EMailLink.SetUnderline(TRUE);
  46. m_EMailLink.SetLinkCursor(AfxGetApp()->LoadCursor(IDC_FINGERTIP));
  47. // Set HyperLink for Home Page
  48. // m_HomePageLink.SetURL((char*)_T(IDS_HOMEPAGEADDR));
  49. m_HomePageLink.SetURL(_T("http:\YuTao.html"));
  50. m_HomePageLink.SetUnderline(TRUE);
  51. m_HomePageLink.SetLinkCursor(AfxGetApp()->LoadCursor(IDC_FINGERTIP));
  52. SetLogoFont("Verdana", -25);
  53. // Write class version
  54. // CString sVersion;
  55. // sVersion.Format("CButtonST v%s", CButtonST::GetVersionC());
  56. // GetDlgItem(IDC_VERSION)->SetWindowText(sVersion);
  57. // Fill friends listbox
  58. CListBox* lbxFriends;
  59. lbxFriends = (CListBox*)GetDlgItem(IDC_FRIENDS);
  60. lbxFriends->AddString("于涛 <YKS7649@yahoo.com>");
  61. return TRUE;
  62. }
  63. void CAboutDlg::SetLogoFont(CString Name, int nHeight, int nWeight, BYTE bItalic, BYTE bUnderline)
  64. {
  65.   if(m_fontLogo.m_hObject) m_fontLogo.Detach();
  66.   m_fontLogo.CreateFont(nHeight, 0, 0, 0, nWeight, bItalic, bUnderline,0,0,0,0,0,0, Name);
  67. } // End of SetLogoFont
  68. void CAboutDlg::OnPaint()
  69. {
  70.     CPaintDC dc(this); // device context for painting
  71.     CRect rectDlg;
  72.     GetWindowRect(rectDlg);
  73.     ScreenToClient(rectDlg);
  74.     CFont* OldFont = dc.SelectObject(&m_fontLogo);
  75. char LOGO[15];
  76. strcpy(LOGO, _T("Quick image"));
  77.     CSize sizeText = dc.GetTextExtent(LOGO);
  78.     dc.DrawState(CPoint((rectDlg.Width()-sizeText.cx)/2, 10), 
  79.                  rectDlg.Size(), 
  80.                  LOGO, 
  81.                  DSS_DISABLED, TRUE, 0, (CBrush*)NULL);
  82.     dc.SelectObject(OldFont);
  83. } // End of OnPaint