// ShowHeader.cpp : implementation file // #include "stdafx.h" #include "uphonebox.h" #include "ShowHeader.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // ShowHeader dialog ShowHeader::ShowHeader(CWnd* pParent /*=NULL*/) : CDialog(ShowHeader::IDD, pParent) { //{{AFX_DATA_INIT(ShowHeader) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void ShowHeader::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(ShowHeader) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(ShowHeader, CDialog) //{{AFX_MSG_MAP(ShowHeader) ON_WM_PAINT() ON_WM_CLOSE() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // ShowHeader message handlers extern void RectFitDes(int width, int height, CRect &rc); void ShowHeader::OnPaint() { CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here if (m_pImg) { CRect rc; GetClientRect(rc); RectFitDes(m_pImg->GetWidth(), m_pImg->GetHeight(), rc); Graphics dcgraph(dc.GetSafeHdc()); Rect destinationRect(rc.left, rc.top, rc.Width(), rc.Height()); dcgraph.DrawImage(m_pImg, destinationRect, 0, 0, m_pImg->GetWidth(), m_pImg->GetHeight(), UnitPixel); } // Do not call CDialog::OnPaint() for painting messages } BOOL ShowHeader::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here *m_pheaderhwnd = this->m_hWnd; return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void ShowHeader::OnClose() { // TODO: Add your message handler code here and/or call default *m_pheaderhwnd = 0; CDialog::OnCancel(); }