PageIcon.cpp
上传用户:ahlaser
上传日期:2020-09-06
资源大小:116k
文件大小:2k
- // PageIcon.cpp : implementation file
- //
- ///////////////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "HighColorTab.h"
- #include "PageIcon.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CPageIcon property page
- IMPLEMENT_DYNAMIC(CPageIcon, CPropertyPage)
- CPageIcon::CPageIcon(const char* lpszTitle, UINT nIconID)
- : CPropertyPage(CPageIcon::IDD),
- m_nIconID(nIconID),
- m_hIcon(NULL)
- {
- //{{AFX_DATA_INIT(CPageIcon)
- //}}AFX_DATA_INIT
- // Set the title and icon.
- if( NULL != m_nIconID )
- {
- m_psp.dwFlags |= PSP_USEHICON;
- HICON hIconTab = AfxGetApp()->LoadIcon( m_nIconID );
- m_psp.hIcon = hIconTab;
- }
- }
- CPageIcon::~CPageIcon()
- {
- }
- void CPageIcon::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CPageIcon)
- DDX_Control(pDX, IDC_PAGE_ICON, m_staticIcon);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CPageIcon, CPropertyPage)
- //{{AFX_MSG_MAP(CPageIcon)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CPageIcon message handlers
- BOOL CPageIcon::OnInitDialog()
- {
- CPropertyPage::OnInitDialog();
-
- // Set icon
- if( NULL != m_nIconID )
- {
- m_hIcon = ::LoadIcon( ::AfxGetInstanceHandle(), MAKEINTRESOURCE(m_nIconID) );
- ASSERT (m_hIcon );
- m_staticIcon.ModifyStyle( 0, SS_ICON );
- m_staticIcon.SetIcon( m_hIcon );
- }
- else
- {
- m_staticIcon.SetWindowText("No icon");
- }
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }